Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: debug 0 balance on L1 #267

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/integration-tests-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ jobs:
- name: List running containers
run: docker ps

- name: Show localhost accounts
run: |
cd packages/integration-tests/src/playbook
npx hardhat accounts --network localhost
- name: API tests run (parallel)
run: |
cd packages/integration-tests
Expand Down
14 changes: 9 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"supertest": "^6.3.3",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"zksync-web3": "^0.14.3"
"zksync-web3": "^0.17.1"
},
"dependencies": {
"ts-jest-resolver": "^2.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// File @openzeppelin/contracts/token/ERC20/[email protected]

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;


contract TokenF2L2 {
// Declare the using directive on the contract scope
using SafeERC20 for IERC20;
using Address for address payable;

//Be able to receive any funds to the contract
receive() external payable {
pay();
}

function pay() public payable {
emit Paid(msg.sender, msg.value, block.timestamp);
}

function getBalance() public view returns (uint) {
return address(this).balance;
}

address public owner;

constructor(address _owner) {
owner = _owner;
}

event Paid(address indexed _from, uint _amount, uint _timestamp);

modifier onlyOwner() {
require(owner == msg.sender, "You are not the owner");
_; // continue
}

function multiTransfer(
address[] memory _recivers,
address[] memory _tokenAddresses,
uint256[] memory _tokenAmounts
) public payable onlyOwner {
// Check that the length of the tokenAddresses array is equal to the length of the tokenAmounts array
require(_tokenAddresses.length == _tokenAmounts.length, "Arrays must have the same length");
require(_tokenAddresses.length == _recivers.length, "Arrays must have the same length");

// Iterate over the arrays and transfer the specified amount of each token
for (uint i = 0; i < _tokenAddresses.length; i++) {
if (_tokenAddresses[i] == address(0)) {
payable(_recivers[i]).sendValue(_tokenAmounts[i]);
} else {
// Cast the token address to an IERC20 contract to access its safeTransfer function
IERC20 token = IERC20(_tokenAddresses[i]);

// Attempt to transfer the specified amount of the token
token.safeTransfer(_recivers[i], _tokenAmounts[i]);
}
}
}
}
Loading
Loading