-
Notifications
You must be signed in to change notification settings - Fork 721
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
backport pallet-xcm::transfer_assets_using_type_and_then() (#3695) #4462
Merged
acatangiu
merged 1 commit into
paritytech:release-crates-io-v1.7.0
from
acatangiu:release-crates-io-v1.7.0-pallet-xcm-backport
May 15, 2024
Merged
backport pallet-xcm::transfer_assets_using_type_and_then() (#3695) #4462
acatangiu
merged 1 commit into
paritytech:release-crates-io-v1.7.0
from
acatangiu:release-crates-io-v1.7.0-pallet-xcm-backport
May 15, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
acatangiu
added
the
R0-silent
Changes should not be mentioned in any release notes
label
May 15, 2024
…h#3695) Add `transfer_assets_using_type_and_then()` for transferring assets from local chain to destination chain using explicit XCM transfer types: - `TransferType::LocalReserve`: transfer assets to sovereign account of destination chain and forward a notification XCM to `dest` to mint and deposit reserve-based assets to `beneficiary`. - `TransferType::DestinationReserve`: burn local assets and forward a notification to `dest` chain to withdraw the reserve assets from this chain's sovereign account and deposit them to `beneficiary`. - `TransferType::RemoteReserve(reserve)`: burn local assets, forward XCM to `reserve` chain to move reserves from this chain's SA to `dest` chain's SA, and forward another XCM to `dest` to mint and deposit reserve-based assets to `beneficiary`. Typically the remote `reserve` is Asset Hub. - `TransferType::Teleport`: burn local assets and forward XCM to `dest` chain to mint/teleport assets and deposit them to `beneficiary`. By default, an asset's reserve is its origin chain. But sometimes we may want to explicitly use another chain as reserve (as long as allowed by runtime `IsReserve` filter). This is very helpful for transferring assets with multiple configured reserves (such as Asset Hub ForeignAssets), when the transfer strictly depends on the used reserve. E.g. For transferring Foreign Assets over a bridge, Asset Hub must be used as the reserve location. ERC20-tokenX is registered on AssetHub as a ForeignAsset by the Polkadot<>Ethereum bridge (Snowbridge). Its asset_id is something like `(parents:2, (GlobalConsensus(Ethereum), Address(tokenX_contract)))`. Its _original_ reserve is Ethereum (only we can't use Ethereum as a reserve in local transfers); but, since tokenX is also registered on AssetHub as a ForeignAsset, we can use AssetHub as a reserve. With this PR we can transfer tokenX from ParaA to ParaB while using AssetHub as a reserve. AssetA created on ParaA but also registered as foreign asset on Asset Hub. Can use AssetHub as a reserve. And all of the above can be done while still controlling transfer type for `fees` so mixing assets in same transfer is supported. 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. This allows usecases such as: https://forum.polkadot.network/t/managing-sas-on-multiple-reserve-chains-for-same-asset/7538/4 Signed-off-by: Adrian Catangiu <[email protected]>
acatangiu
force-pushed
the
release-crates-io-v1.7.0-pallet-xcm-backport
branch
from
May 15, 2024 08:13
4fe5303
to
3a064c5
Compare
The CI pipeline was cancelled due to failure one of the required jobs. |
bkontur
approved these changes
May 15, 2024
acatangiu
merged commit May 15, 2024
98dc667
into
paritytech:release-crates-io-v1.7.0
18 of 68 checks passed
fellowship-merge-bot bot
pushed a commit
to polkadot-fellows/runtimes
that referenced
this pull request
May 17, 2024
…et transfers (#311) Bump `pallet-xcm` to 8.0.5 to include `transfer_assets_using_type_and_then()` call to facilitate moving bridged assets around the ecosystem. Example [test for bridged asset AssetHub->Parachain](https://github.com/paritytech/polkadot-sdk/blob/e0584a153df63ff138d12764085422ed06de548a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/hybrid_transfers.rs#L150C1-L156C54) - the actual call used [here](https://github.com/paritytech/polkadot-sdk/blob/e0584a153df63ff138d12764085422ed06de548a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/hybrid_transfers.rs#L57C1-L70C3). Example [test for bridged asset Parachain->AssetHub](https://github.com/paritytech/polkadot-sdk/blob/e0584a153df63ff138d12764085422ed06de548a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/hybrid_transfers.rs#L278C1-L285C54) - the actual call used [here](https://github.com/paritytech/polkadot-sdk/blob/e0584a153df63ff138d12764085422ed06de548a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/hybrid_transfers.rs#L76C2-L89C3). More details on the backported call available here: paritytech/polkadot-sdk#4462 Fixes #281 --------- Signed-off-by: Adrian Catangiu <[email protected]> Co-authored-by: Branislav Kontur <[email protected]> Co-authored-by: Bastian Köcher <[email protected]>
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/managing-sas-on-multiple-reserve-chains-for-same-asset/7538/7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
transfer_assets_using_type_and_then()
for transferring assets fromlocal chain to destination chain using explicit XCM transfer types:
TransferType::LocalReserve
: transfer assets to sovereign account of destination chain and forward a notification XCM todest
to mint and deposit reserve-based assets tobeneficiary
.TransferType::DestinationReserve
: burn local assets and forward a notification todest
chain to withdraw the reserve assets from this chain's sovereign account and deposit them tobeneficiary
.TransferType::RemoteReserve(reserve)
: burn local assets, forward XCM toreserve
chain to move reserves from this chain's SA todest
chain's SA, and forward another XCM todest
to mint and deposit reserve-based assets tobeneficiary
. Typically the remotereserve
is Asset Hub.TransferType::Teleport
: burn local assets and forward XCM todest
chain to mint/teleport assets and deposit them tobeneficiary
.By default, an asset's reserve is its origin chain. But sometimes we may want to explicitly use another chain as reserve (as long as allowed by runtime
IsReserve
filter).This is very helpful for transferring assets with multiple configured reserves (such as Asset Hub ForeignAssets), when the transfer strictly depends on the used reserve.
E.g. For transferring Foreign Assets over a bridge, Asset Hub must be used as the reserve location.
ERC20-tokenX is registered on AssetHub as a ForeignAsset by the Polkadot<>Ethereum bridge (Snowbridge). Its asset_id is something like
(parents:2, (GlobalConsensus(Ethereum), Address(tokenX_contract)))
. Its original reserve is Ethereum (only we can't use Ethereum as a reserve in local transfers); but, since tokenX is also registered on AssetHub as a ForeignAsset, we can use AssetHub as a reserve.With this PR we can transfer tokenX from ParaA to ParaB while using AssetHub as a reserve.
AssetA created on ParaA but also registered as foreign asset on Asset Hub. Can use AssetHub as a reserve.
And all of the above can be done while still controlling transfer type for
fees
so mixing assets in same transfer is supported.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.This allows usecases such as:
https://forum.polkadot.network/t/managing-sas-on-multiple-reserve-chains-for-same-asset/7538/4