XCM - xTokens
XCM precompiles - Interface
The interface can be found here and contains the following functions:
info
Only available in Shibuya for now. For Shiden and Astar please check this interface
transfer(currencyAddress, amount, destination, weight)
Transfer a token through XCM based on its address
function transfer(
address currencyAddress,
uint256 amount,
Multilocation memory destination,
WeightV2 memory weight
) external returns (bool);
- currencyAddress - The ERC20 address of the currency we want to transfer
- amount - The amount of tokens we want to transfer
- destination - The Multilocation to which we want to send the tokens
- weight - The weight we want to buy in the destination chain, to set the weightlimit to Unlimited, you should use the value 0 for ref_time
transfer_with_fee(currencyAddress, amount, fee, destination, weight)
Transfer a token through XCM based on its address specifying fee
function transfer_with_fee(
address currencyAddress,
uint256 amount,
uint256 fee,
Multilocation memory destination,
WeightV2 memory weight
) external returns (bool);
- currencyAddress - The ERC20 address of the currency we want to transfer
- amount - The amount of tokens we want to transfer
- fee - The amount to be spent to pay for execution in destination chain
- destination - The Multilocation to which we want to send the tokens
- weight - The weight we want to buy in the destination chain, to set the weightlimit to Unlimited, you should use the value 0 for ref_time
transfer_multiasset(asset, amount, destination, weight)
Transfer a token through XCM based on its MultiLocation
function transfer_multiasset(
Multilocation memory asset,
uint256 amount,
Multilocation memory destination,
WeightV2 memory weight
) external returns (bool);
- asset - The asset we want to transfer, defined by its multilocation. Currently only Concrete Fungible assets
- amount - The amount of tokens we want to transfer
- destination - The Multilocation to which we want to send the tokens
- weight - The weight we want to buy in the destination chain, to set the weightlimit to Unlimited, you should use the value 0 for ref_time
transfer_multiasset_with_fee(asset, amount, fee, destination, weight)
Transfer a token through XCM based on its MultiLocation specifying fee
function transfer_multiasset_with_fee(
Multilocation memory asset,
uint256 amount,
uint256 fee,
Multilocation memory destination,
WeightV2 memory weight
) external returns (bool);
- asset - The asset we want to transfer, defined by its multilocation. Currently only Concrete Fungible assets
- amount - The amount of tokens we want to transfer
- fee - The amount to be spent to pay for execution in destination chain
- destination - The Multilocation to which we want to send the tokens
- weight - The weight we want to buy in the destination chain, to set the weightlimit to Unlimited, you should use the value 0 for ref_time
transfer_multi_currencies(currencies, feeItem, destination, weight)
Transfer several tokens at once through XCM based on its address specifying fee
function transfer_multiasset_with_fee(
Multilocation memory asset,
uint256 amount,
uint256 fee,
Multilocation memory destination,
WeightV2 memory weight
) external returns (bool);
- currencies - The currencies we want to transfer, defined by their address and amount.
- feeItem - Which of the currencies to be used as fee
- destination - The Multilocation to which we want to send the tokens
- weight - The weight we want to buy in the destination chain, to set the weightlimit to Unlimited, you should use the value 0 for ref_time
transfer_multi_assets(assets, feeItem, destination, weight)
Transfer several tokens at once through XCM based on its location specifying fee
caution
Only a maximum of 2 assets can be transferred
function transfer_multi_assets(
MultiAsset[] memory assets,
uint32 feeItem,
Multilocation memory destination,
WeightV2 memory weight
) external returns (bool);