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.
Signed-off-by: deniallugo <[email protected]>
- Loading branch information
1 parent
e7d689e
commit bf5ee9c
Showing
6 changed files
with
146 additions
and
50 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity ^0.7.0; | ||
|
||
pragma experimental ABIEncoderV2; | ||
|
||
import "../ZkSync.sol"; | ||
|
||
contract PendingBalanceWithdrawer { | ||
ZkSync constant zkSync = ZkSync($(ZKSYNC_ADDRESS)); | ||
|
||
struct RequestWithdrawFT { | ||
address payable owner; | ||
address token; | ||
uint256 gas; | ||
} | ||
|
||
struct RequestWithdrawNFT { | ||
uint32 tokenId; | ||
uint256 gas; | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
extern crate core; | ||
|
||
use zksync_types::{Account, AccountId, Address}; | ||
|
||
pub use self::{ | ||
|
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