Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update XCM Precompile Docs #1016

Merged
merged 7 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,68 +35,139 @@ interface XCM {
uint256 amount;
}

// The values start at `0` and are represented as `uint8`
enum TransferType {
Teleport,
LocalReserve,
DestinationReserve
}

/// @dev Function to send assets via XCM using transfer_assets() pallet-xcm extrinsic.
/// @custom:selector 59df8416
/// @custom:selector 9ea8ada7
/// @param dest The destination chain.
/// @param beneficiary The actual account that will receive the tokens on dest.
/// @param assets The combination (array) of assets to send.
/// @param assets The combination (array) of assets to send in Location format.
/// @param feeAssetItem The index of the asset that will be used to pay for fees.
/// @param weight The weight to be used for the whole XCM operation.
/// (uint64::MAX in refTime means Unlimited weight)
function transferAssetsLocation(
Location memory dest,
Location memory beneficiary,
AssetLocationInfo[] memory assets,
uint32 feeAssetItem,
Weight memory weight
uint32 feeAssetItem
) external;

/// @dev Function to send assets via XCM to a 20 byte-like parachain
/// using transfer_assets() pallet-xcm extrinsic.
/// @custom:selector b489262e
/// @custom:selector a0aeb5fe
/// @param paraId The para-id of the destination chain.
/// @param beneficiary The actual account that will receive the tokens on paraId destination.
/// @param assets The combination (array) of assets to send.
/// @param assets The combination (array) of assets to send in Address format.
/// @param feeAssetItem The index of the asset that will be used to pay for fees.
/// @param weight The weight to be used for the whole XCM operation.
/// (uint64::MAX in refTime means Unlimited weight)
function transferAssetsToPara20(
uint32 paraId,
address beneficiary,
AssetAddressInfo[] memory assets,
uint32 feeAssetItem,
Weight memory weight
uint32 feeAssetItem
) external;

/// @dev Function to send assets via XCM to a 32 byte-like parachain
/// using transfer_assets() pallet-xcm extrinsic.
/// @custom:selector 4461e6f5
/// @custom:selector f23032c3
/// @param paraId The para-id of the destination chain.
/// @param beneficiary The actual account that will receive the tokens on paraId destination.
/// @param assets The combination (array) of assets to send.
/// @param assets The combination (array) of assets to send in Address format.
/// @param feeAssetItem The index of the asset that will be used to pay for fees.
/// @param weight The weight to be used for the whole XCM operation.
/// (uint64::MAX in refTime means Unlimited weight)
function transferAssetsToPara32(
uint32 paraId,
bytes32 beneficiary,
AssetAddressInfo[] memory assets,
uint32 feeAssetItem,
Weight memory weight
uint32 feeAssetItem
) external;

/// @dev Function to send assets via XCM to the relay chain
/// using transfer_assets() pallet-xcm extrinsic.
/// @custom:selector d7c89659
/// @custom:selector 6521cc2c
/// @param beneficiary The actual account that will receive the tokens on the relay chain.
/// @param assets The combination (array) of assets to send.
/// @param assets The combination (array) of assets to send in Address format.
/// @param feeAssetItem The index of the asset that will be used to pay for fees.
/// @param weight The weight to be used for the whole XCM operation.
/// (uint64::MAX in refTime means Unlimited weight)
function transferAssetsToRelay(
bytes32 beneficiary,
AssetAddressInfo[] memory assets,
uint32 feeAssetItem,
Weight memory weight
uint32 feeAssetItem
) external;

/// @dev Function to send assets through transfer_assets_using_type_and_then() pallet-xcm
/// extrinsic.
/// Important: in this selector RemoteReserve type (for either assets or fees) is not allowed.
/// If users want to send assets and fees (in Location format) with a remote reserve,
/// they must use the selector fc19376c.
/// @custom:selector 8425d893
/// @param dest The destination chain.
/// @param assets The combination (array) of assets to send in Location format.
/// @param assetsTransferType The TransferType corresponding to assets being sent.
/// @param remoteFeesIdIndex The index of the asset (inside assets array) to use as fees.
/// @param feesTransferType The TransferType corresponding to the asset used as fees.
/// @param customXcmOnDest The XCM message to execute on destination chain.
function transferAssetsUsingTypeAndThenLocation(
Location memory dest,
AssetLocationInfo[] memory assets,
TransferType assetsTransferType,
uint8 remoteFeesIdIndex,
TransferType feesTransferType,
bytes memory customXcmOnDest
) external;

/// @dev Function to send assets through transfer_assets_using_type_and_then() pallet-xcm
/// extrinsic.
/// @custom:selector fc19376c
/// @param dest The destination chain.
/// @param assets The combination (array) of assets to send in Location format.
/// @param remoteFeesIdIndex The index of the asset (inside assets array) to use as fees.
/// @param customXcmOnDest The XCM message to execute on destination chain.
/// @param remoteReserve The remote reserve corresponding for assets and fees. They MUST
/// share the same reserve.
function transferAssetsUsingTypeAndThenLocation(
Location memory dest,
AssetLocationInfo[] memory assets,
uint8 remoteFeesIdIndex,
bytes memory customXcmOnDest,
Location memory remoteReserve
) external;

/// @dev Function to send assets through transfer_assets_using_type_and_then() pallet-xcm
/// extrinsic.
/// Important: in this selector RemoteReserve type (for either assets or fees) is not allowed.
/// If users want to send assets and fees (in Address format) with a remote reserve,
/// they must use the selector aaecfc62.
/// @custom:selector 998093ee
/// @param dest The destination chain.
/// @param assets The combination (array) of assets to send in Address format.
/// @param assetsTransferType The TransferType corresponding to assets being sent.
/// @param remoteFeesIdIndex The index of the asset (inside assets array) to use as fees.
/// @param feesTransferType The TransferType corresponding to the asset used as fees.
/// @param customXcmOnDest The XCM message to execute on destination chain.
function transferAssetsUsingTypeAndThenAddress(
Location memory dest,
AssetAddressInfo[] memory assets,
TransferType assetsTransferType,
uint8 remoteFeesIdIndex,
TransferType feesTransferType,
bytes memory customXcmOnDest
) external;

/// @dev Function to send assets through transfer_assets_using_type_and_then() pallet-xcm
/// extrinsic.
/// @custom:selector aaecfc62
/// @param dest The destination chain.
/// @param assets The combination (array) of assets to send in Address format.
/// @param remoteFeesIdIndex The index of the asset (inside assets array) to use as fees.
/// @param customXcmOnDest The XCM message to execute on destination chain.
/// @param remoteReserve The remote reserve corresponding for assets and fees. They MUST
/// share the same reserve.
function transferAssetsUsingTypeAndThenAddress(
Location memory dest,
AssetAddressInfo[] memory assets,
uint8 remoteFeesIdIndex,
bytes memory customXcmOnDest,
Location memory remoteReserve
) external;
}
3 changes: 3 additions & 0 deletions builders/ethereum/canonical-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ There are a set of precompiled contracts included on Moonbeam, Moonriver, and Mo
| [GMP](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/gmp/Gmp.sol){target=\_blank} | {{networks.moonbeam.precompiles.gmp}} |
| [XCM Transactor V3](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/xcm-transactor/src/v3/XcmTransactorV3.sol){target=\_blank} | {{networks.moonbeam.precompiles.xcm_transactor_v3}} |
| [Identity](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/identity/Identity.sol){target=\_blank} | {{networks.moonbeam.precompiles.identity}} |
| [XCM Interface](https://github.com/Moonsong-Labs/moonkit/blob/main/precompiles/pallet-xcm/XcmInterface.sol){target=\_blank} | {{networks.moonbeam.precompiles.xcm_interface}} |

=== "Moonriver"
| Contract | Address |
Expand Down Expand Up @@ -115,6 +116,7 @@ There are a set of precompiled contracts included on Moonbeam, Moonriver, and Mo
| [GMP](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/gmp/Gmp.sol){target=\_blank} | {{networks.moonriver.precompiles.gmp}} |
| [XCM Transactor V3](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/xcm-transactor/src/v3/XcmTransactorV3.sol){target=\_blank} | {{networks.moonriver.precompiles.xcm_transactor_v3}} |
| [Identity](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/identity/Identity.sol){target=\_blank} | {{networks.moonriver.precompiles.identity}} |
| [XCM Interface](https://github.com/Moonsong-Labs/moonkit/blob/main/precompiles/pallet-xcm/XcmInterface.sol){target=\_blank} | {{networks.moonriver.precompiles.xcm_interface}} |

=== "Moonbase Alpha"
| Contract | Address |
Expand Down Expand Up @@ -144,3 +146,4 @@ There are a set of precompiled contracts included on Moonbeam, Moonriver, and Mo
| [GMP](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/gmp/Gmp.sol){target=\_blank} | {{networks.moonbase.precompiles.gmp}} |
| [XCM Transactor V3](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/xcm-transactor/src/v3/XcmTransactorV3.sol){target=\_blank} | {{networks.moonbase.precompiles.xcm_transactor_v3}} |
| [Identity](https://github.com/moonbeam-foundation/moonbeam/blob/master/precompiles/identity/Identity.sol){target=\_blank} | {{networks.moonbase.precompiles.identity}} |
| [XCM Interface](https://github.com/Moonsong-Labs/moonkit/blob/main/precompiles/pallet-xcm/XcmInterface.sol){target=\_blank} | {{networks.moonbase.precompiles.xcm_interface}} |
Loading
Loading