Asset Cross-chain
Last updated
interface IMOS {
// Transfer token to another chain
function transferOutToken(
address _token,
bytes memory _to,
uint256 _amount,
uint256 _toChain
) external;
// Transfer native token to another chain
function transferOutNative(
bytes memory _to,
uint256 _toChain
) external payable;
// Deposit token to vault (provide liquidity)
function depositToken(
address _token,
address _to,
uint256 _amount
) external;
// Deposit native token to vault
function depositNative(address _to) external payable;
// Check if token is bridgeable to target chain
function isBridgeable(
address _token,
uint256 _toChain
) external view returns (bool);
}// Transfer 100 USDC to BSC
IERC20(usdcAddress).approve(mosAddress, 100e6);
IMOS(mosAddress).transferOutToken(
usdcAddress, // token
abi.encodePacked(to), // receiver on target chain
100e6, // amount
56 // BSC chain id
);
// Transfer native token (e.g., ETH) to BSC
IMOS(mosAddress).transferOutNative{value: 1 ether}(
abi.encodePacked(to), // receiver
56 // BSC chain id
);