Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Xtokens seems incompatible with what statemint expects #827

Open
girazoki opened this issue Dec 3, 2021 · 4 comments
Open

Xtokens seems incompatible with what statemint expects #827

girazoki opened this issue Dec 3, 2021 · 4 comments
Labels
T6-XCM This PR/Issue is related to XCM.

Comments

@girazoki
Copy link
Contributor

girazoki commented Dec 3, 2021

Test Scenario: We have an asset created in Statemint, and transferred (reserve transfer asset) to Moonbeam. This transfer works as expected. But when willing to transfer back this asset with Xtokens, Statemint is expecting a GeneralIndex(asset_id) but Xtokens, after inverting its location and reanchoring the asset, sends MultiLocation { parents:1, interior: X2(ParachainId(statemint_para_id), GeneralIndex(asset_id))}. Therefore we obtain a FailedAssetTransact

I have just made a couple of tests on this, would like to investigate further.

@xlc
Copy link
Contributor

xlc commented Dec 4, 2021

Related: #806

@yrong
Copy link

yrong commented Dec 4, 2021

@xlc I think in orml-xtokens we may need some api to support transfering multiple assets(now only one) and with the ability to specific which asset as fee, details here

@xlc
Copy link
Contributor

xlc commented Dec 4, 2021

Please write an issue to https://github.com/open-web3-stack/open-runtime-module-library/issues but yeah I agree we need that.

@gavofyork
Copy link
Member

Yes, Statemint will expect an XCM with its local asset ID (GeneralIndex(asset_id)). The reanchoring process from Xtokens to Statemint should result in an asset from Xtokens known as (Parent, Parachain(Statemint), GeneralIndex(asset_id)) being translated to GeneralIndex(asset_id) which is what Statemint expects. So all third-party chains must ensure that reserve assets based on Statemint are known in XCM as (Parent, Parachain(Statemint), GeneralIndex(asset_id)). This is pretty easy to do with the AsPrefixedGeneralIndex. If chains want to have assets in them other than the assets sent by Statemint, then they can have two separate instances of the Assets pallet, one whose assets are known in XCM as (Parent, Parachain(Statemint), GeneralIndex(asset_id)), and the other with a different XCM location prefix. This namespaces the asset IDs and keeps a locally-created asset from interfering with a Statemint reserve asset of the same index.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

No branches or pull requests

5 participants