forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2243: Add gas cost to testkit about pending withdraw r=Deniallugo a=Deniallugo Signed-off-by: deniallugo <[email protected]> Co-authored-by: deniallugo <[email protected]>
- Loading branch information
Showing
7 changed files
with
172 additions
and
5 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
contracts/contracts/dev-contracts/PendingBalanceWithdrawer.sol
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,45 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity ^0.7.0; | ||
|
||
pragma experimental ABIEncoderV2; | ||
|
||
import "../ZkSync.sol"; | ||
|
||
contract PendingBalanceWithdrawer { | ||
ZkSync immutable zkSync; | ||
|
||
struct RequestWithdrawFT { | ||
address payable owner; | ||
address token; | ||
uint256 gas; | ||
} | ||
|
||
struct RequestWithdrawNFT { | ||
uint32 tokenId; | ||
uint256 gas; | ||
} | ||
|
||
constructor(address _zkSync) { | ||
zkSync = ZkSync(_zkSync); | ||
} | ||
|
||
function withdrawPendingBalances( | ||
RequestWithdrawFT[] calldata _FTRequests, | ||
RequestWithdrawNFT[] calldata _NFTRequests | ||
) external { | ||
for (uint256 i = 0; i < _FTRequests.length; ++i) { | ||
try | ||
zkSync.withdrawPendingBalance{gas: _FTRequests[i].gas}( | ||
_FTRequests[i].owner, | ||
_FTRequests[i].token, | ||
type(uint128).max | ||
) | ||
{} catch {} | ||
} | ||
|
||
for (uint256 i = 0; i < _NFTRequests.length; ++i) { | ||
try zkSync.withdrawPendingNFTBalance{gas: _NFTRequests[i].gas}(_NFTRequests[i].tokenId) {} catch {} | ||
} | ||
} | ||
} |
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 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