1

We want to create a pool and we need to provide asset1 and asset2 values to the function, we are not sure what those asset1 and 2 are exactly (we are not sure what it represents or where to find it).

We concluded based on assumption(no documentation for this) that we need to provide id's of two assets that we created, the problem is that the assets id's are of type u32(when creating an asset in asset hub) but the createPool expects an asset of type -> XcmV3MultiLocation (MultiAssetId).

if that is true we are not sure how to convert the asset from u32 to MultiAssetId.

Question: how do we represent an asset created in asset hub for which we have a u32 id as a type XcmV3MultiLocation (MultiAssetId) - so we can use it to create the pool.

Link to the pallet code: https://github.com/paritytech/substrate/blob/master/frame/asset-conversion/README.md

polkadot.js westend asset hub / westmint rpc - assetConversion pallet: polkadot.js westend asset hub / westmint rpc - assetConversion pallet

1 Answer 1

3

As you mentioned above, the createPool call expects MultiLocation parameters of either Native or non-native AssetIds. For example: from the perspective of AssetHub, an AssetHub asset with an AssetId of 13 has a MultiLocation of

{
   parents: 0, 
   interior: { 
     X2: [{PalletInstance: 50}, {GeneralIndex: 13}]
   }
}

The PalletInstance of 50 represents the Assets pallet on AssetHub and the GeneralIndex is the u32 AssetId of the asset.

So in this case you can substitute 13 with the u32 AssetId of either of the two assets you've created in order to get their represented MultiLocations to pass to createPool.

Note: For AssetHub Westend, one of the parameters must be of the Native asset which has a MultiLocation that can be represented as

{ parents: 1, interior: { 'Here': ''}}, 

With that in mind, a complete representation of the createPool params would be 1 custom asset and the Native asset in any order such as

{ parents: 1, interior: { 'Here': ''}}, 
{ parents: 0, interior: { X2: [{'PalletInstance': 50}, {'GeneralIndex': 13}]}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.