-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #643 from matter-labs/ib/638/ERC20_withdraw_guard
ERC20 withdraw guard
- Loading branch information
Showing
9 changed files
with
102 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "../generated/ZkSyncTest.sol"; | ||
|
||
|
||
contract ZkSyncProcessOpUnitTest is ZkSyncTest { | ||
|
||
function testProcessOperation( | ||
bytes calldata _publicData, | ||
bytes calldata _ethWitness, | ||
uint32[] calldata _ethWitnessSizes | ||
) external { | ||
collectOnchainOps(0, _publicData, _ethWitness, _ethWitnessSizes); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "../generated/ZkSyncTest.sol"; | ||
|
||
|
||
contract ZKSyncSignatureUnitTest is ZkSyncTest { | ||
|
||
function changePubkeySignatureCheck(bytes calldata _signature, bytes20 _newPkHash, uint32 _nonce, address _ethAddress, uint24 _accountId) external pure returns (bool) { | ||
return verifyChangePubkeySignature(_signature, _newPkHash, _nonce, _ethAddress, _accountId); | ||
} | ||
|
||
function testRecoverAddressFromEthSignature(bytes calldata _signature, bytes calldata _message) external pure returns (address) { | ||
return Utils.recoverAddressFromEthSignature(_signature, _message); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "../generated/ZkSyncTest.sol"; | ||
|
||
|
||
contract ZkSyncWithdrawalUnitTest is ZkSyncTest { | ||
|
||
function setBalanceToWithdraw(address _owner, uint16 _token, uint128 _amount) external { | ||
balancesToWithdraw[packAddressAndTokenId(_owner, _token)].balanceToWithdraw = _amount; | ||
} | ||
|
||
function receiveETH() payable external{} | ||
|
||
function addPendingWithdrawal(address _to, uint16 _tokenId, uint128 _amount) external { | ||
pendingWithdrawals[firstPendingWithdrawalIndex + numberOfPendingWithdrawals] = PendingWithdrawal(_to, _tokenId); | ||
numberOfPendingWithdrawals++; | ||
bytes22 packedBalanceKey = packAddressAndTokenId(_to, _tokenId); | ||
balancesToWithdraw[packedBalanceKey].balanceToWithdraw += _amount; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters