pallet-xcm::transfer_assets_using_type() supports custom actions on destination (#4260)

Change `transfer_assets_using_type()` to not assume `DepositAssets` as
the intended use of the assets on the destination.

Instead provides the caller with the ability to specify custom XCM that
be executed on `dest` chain as the last step of the transfer, thus
allowing custom usecases for the transferred assets. E.g. some are
used/swapped/etc there, while some are sent further to yet another
chain.

Note: this is a follow-up on
https://github.com/paritytech/polkadot-sdk/pull/3695, bringing in an API
change for `transfer_assets_using_type()`. This is ok as the previous
version has not been yet released. Thus, its first release will include
the new API proposed by this PR.

This allows usecases such as:
https://forum.polkadot.network/t/managing-sas-on-multiple-reserve-chains-for-same-asset/7538/4

BTW: all this pallet-xcm asset transfers code will be massively reduced
once we have https://github.com/paritytech/xcm-format/pull/54

---------

Signed-off-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
Adrian Catangiu
2024-04-24 11:44:42 +03:00
committed by GitHub
parent 9a0049d0da
commit e0584a153d
12 changed files with 531 additions and 116 deletions
+8 -1
View File
@@ -6,7 +6,7 @@ title: "pallet-xcm: add new extrinsic for asset transfers using explicit reserve
doc:
- audience: Runtime User
description: |
pallet-xcm has a new extrinsic `transfer_assets_using_type` for transferring
pallet-xcm has a new extrinsic `transfer_assets_using_type_and_then` for transferring
assets from local chain to destination chain using an explicit XCM transfer
types for transferring the assets and the fees:
- `TransferType::LocalReserve`: transfer assets to sovereign account of destination
@@ -33,6 +33,13 @@ doc:
Same when transferring bridged assets back across the bridge, the local bridging
parachain must be used as the explicit reserve location.
The new method takes a `custom_xcm_on_dest` parameter allowing the caller to specify
what should happen to the transferred assets once they reach
the `dest` chain. The `custom_xcm_on_dest` parameter should contains the instructions
to execute on `dest` as a final step. Usually as simple as:
`Xcm(vec![DepositAsset { assets: Wild(AllCounted(assets.len())), beneficiary }])`,
but could be something more exotic like sending the `assets` even further.
crates:
- name: pallet-xcm
bump: minor