Skip to main content

Transfer Vault

L2Vault.sol is used in the Transfer page and provides a way for users to transfer assets between supported layers.

Metadata

  • Upgradable
  • Nonreentrant
  • Ownable

Deployments

ChainTypeAddress
1 (mainnet)proxy0x29E0A2A859301957C93E626Eb611Ff4D41291cAD
1 (mainnet)implementation0xdA4bFd2505a1CF1b10eA3969112D488F2Db0A72D
137 (Polygon)proxy0xCd8e7322dc2659b1ec447e5d52FDd9c67e8C3c01
137 (Polygon)implementation0x97DAE0Dd237914CE273146d36a584cFF1Cc4217A
42161 (Arbitrum)proxy0xEba8C2Bf0d1C9413543188fc42D7323690AED051
42161 (Arbitrum)implementation0x23bcFcEbf02cA89e9862CaC4D0d41B4f56C58A5B
43114 (Avalanche)proxy0xAC5b41d45ac10E28C34d201E491a3CCe6932FDF1
43114 (Avalanche)implementation0x498553bb7d96B47B6017F799c6Aa4eAA0D30115a
1285 (Moonriver)proxy0x23Bdb092ACC1660faF1f6eE8C1846BbCf2A7aFB2
1285 (Moonriver)implementation0x7C6B24Dcabf3ff5e00d88Bd4daCDc8E81A1e22DE

Events

// Event emitted when user initiates a transferevent DepositCompleted(      address indexed account,      address indexed erc20,      address indexed remoteTokenAddress,      uint256 remoteNetworkID,      address destination,      uint256 value,      bytes32 uniqueId,      uint256 transferDelay  );
// Event emitted when funds are released for `accountTo`event WithdrawalCompleted(    address indexed accountTo,    uint256 amount,    uint256 receivedAmount,    uint256 feeAmount,    address indexed tokenAddress,    bytes32 indexed uniqueId);
// Events emitted when token is added or removed to/from the supported assets listevent TokenAdded(    address indexed erc20,    address indexed remoteTokenAddress,    uint256 indexed remoteNetworkID,    uint256 maxTransferSize,    uint256 minTransferSize);event TokenRemoved(    address indexed erc20,    address indexed remoteTokenAddress,    uint256 indexed remoteNetworkID);
// Events emitted when min or max transfer amount for an asset is changedevent AssetMinTransferSizeChanged(    address indexed erc20,    uint256 newMinSize);event AssetMaxTransferSizeChanged(    address indexed erc20,    uint256 newMaxSize);
// Events emitted when min or max fee amount is changed; fee taken is between a range like 0.25 to 4%event MinFeeChanged(uint256 newMinFee);event MaxFeeChanged(uint256 newMaxFee);
// Event emitted when min or max transfer delay for an asset is changed; if flow is not completed until max delay, funds are returned to the source layerevent MinTransferDelayChanged(uint256 newMinTransferDelay);event MaxTransferDelayChanged(uint256 newMaxTransferDelay);
// Event emitted when fee threshold is changed; after a specific threshold fee is always equal to the max fee (after x% of the available liquidity)event ThresholdFeeChanged(uint256 newFeeThreshold);
// Event emitted when fee address is changedevent FeeAddressChanged(address feeAddress);
// Event emitted when available liquidity is withdrawn from the vaultevent LiquidityMoved(    address indexed _owner,    address indexed _to,    uint256 amount);
// Event emitted on the source layer for the moments when flow failed and funds are returned to the userevent FundsUnlocked(    address indexed tokenAddress,    address indexed user,    uint256 amount,    bytes32 indexed uniqueId);
// Event emitted after flow is completed to mark the locked funds as available to be used in other transfersevent TransferFundsUnlocked(    address indexed tokenAddress,    uint256 amount,    bytes32 uniqueId);
// Event emitted when lockup timestamp is changed; represents a time windows until when transfers are not available for the same user, on the same source layerevent LockupTimeChanged(    address indexed _owner,    uint256 _oldVal,    uint256 _newVal,    string valType);
// Events emitted when all the L2Vault's functionality is paused/resumedevent Pause(address admin);event Unpause(address admin);
// Event emitted when fee was takenevent FeeTaken(    address indexed _owner,    address indexed _user,    address indexed _token,    uint256 _amount,    uint256 _fee,    bytes32 uniqueId);

Methods

// emits TokenAddedfunction addSupportedToken(      address tokenAddress,      address tokenAddressRemote,      uint256 remoteNetworkID,      uint256 maxTransferSize,      uint256 minTransferSize  ) external onlyOwner 
// emits TokenRemovedfunction removeSupportedToken(address tokenAddress, uint256 remoteNetworkID)      external      onlyOwner      onlySupportedRemoteTokens(remoteNetworkID, tokenAddress)
// emits AssetMinTransferSizeChangedfunction setAssetMinTransferSize(address tokenAddress, uint256 _size)      external      onlyOwner
// emits AssetMaxTransferSizeChangedfunction setAssetMaxTransferSize(address tokenAddress, uint256 _size)      external      onlyOwner
// emits LockupTimeChangedfunction setTransferLockupTime(uint256 lockupTime) external onlyOwner 
// emits Puasefunction pause() external onlyOwner whenNotPaused
// emits Unpausefunction unpause() external onlyOwner
// emits MinTransferDelayChangedfunction setMinTransferDelay(uint256 newMinTransferDelay)      external      onlyOwner
// emits MinTransferDelayChangedfunction setMaxTransferDelay(uint256 newMaxTransferDelay)      external      onlyOwner
// emits MinFeeChangedfunction setMinFee(uint256 newMinFee) external onlyOwner 
// emits MaxFeeChangedfunction setMaxFee(uint256 newMaxFee) external onlyOwner 
// emits FeeAddressChangedfunction setFeeAddress(address newFeeAddress) external onlyOwner
// emits DepositCompletedfunction depositERC20(      uint256 amount,      address tokenAddress,      address destinationAddress,      uint256 remoteNetworkID,      uint256 transferDelay  )      external      onlySupportedRemoteTokens(remoteNetworkID, tokenAddress)      nonReentrant      whenNotPaused
// emits WithdrawalCompletedfunction withdrawTo(      address accountTo,      uint256 amount,      address tokenAddress,      uint256 remoteNetworkID,      bytes32 id  )  external  onlySupportedRemoteTokens(remoteNetworkID, tokenAddress)  nonReentrant  onlyOwner  whenNotPaused
// emits LiquidityMovedfunction saveFunds(address _token, address _to) external onlyOwner
// emits TransferFundsUnlockedfunction unlockInTransferFunds(      address _token,      uint256 _amount,      bytes32 _id  ) public whenNotPaused onlyOwner
// emits FundsUnlockedfunction unlockFunds(      address _token,      address _user,      uint256 amount,      bytes32 id  ) external onlyOwner nonReentrant

function getRemoteTokenAddress(uint256 _networkID, address _tokenAddress)        external        view        returns (address tokenAddressRemote)    function getCurrentTokenLiquidity(address tokenAddress)        public        view        returns (uint256)
function calculateFeePercentage(address tokenAddress, uint256 amount)        public        view        returns (uint256)