Transferal.sol
An embedded library helping you to transfer tokens between different layer 2 networks and other operations applicable for Mosaic Vaults.
Usage
function checkIfVaultIsPaused() public view returns (bool) { return Transferal.isPaused();}
function initiaterTransfer( uint256 amount, address tokenAddress, address destinationAddress, uint256 remoteNetworkID, uint256 transferDelay) public { address vaultAddress = Transferal.getVaultAddress(); Operations.safeApprove(tokenAddress, vaultAddress, amount); return Transferal.depositToken(amount, tokenAddress, destinationAddress, remoteNetworkID, transferDelay);}
Methods
// Check if L2Vault is pausedfunction isPaused() internal view returns (bool)
// Check if token is supported by L2Vaultfunction isTokenSupported(address tokenAddress, uint256 networkId) internal view isValidTokenAddress(tokenAddress) returns (bool)
// Compute fee that would be taken when transferring to the current layerfunction calculateFeePercentage(address tokenAddress, uint256 amount) internal view isValidTokenAddress(tokenAddress) returns (uint256)
// Get token's available liquidity on the current layerfunction getVaultTokenBalance(address tokenAddress) internal view isValidTokenAddress(tokenAddress) returns (uint256)
// Initiate transfer by using the current layer as the source layerfunction depositToken( uint256 amount, address tokenAddress, address destinationAddress, uint256 remoteNetworkID, uint256 transferDelay) internalisValidTokenAddress(tokenAddress)