open-runtime-module-library icon indicating copy to clipboard operation
open-runtime-module-library copied to clipboard

Transfer KSM from Parachain A to Statemine

Open samelamin opened this issue 3 years ago • 6 comments

I have been wondering if we can use XTokens to transfer assets to Statemine directly assuming the channel is open, this will save on transfer fees

At the moment I was able to transfer KSM to the relay chain using XTransfer to the Parent/Relay chain and then teleport the KSM to Statemine

I wonder if it's possible to simplify that by sending a message to the relay chain to teleport the asset and then burn the asset on chain?

Obviously this only works if teleport works between the chains and a level of trust is already established. But since its already there for Statemine, It should be possible right?

samelamin avatar May 20 '22 13:05 samelamin

Current using XToken to transfer KSM from parachain to Statemine, is like the kind of NonReserve case, and it works already, I add a testcase in: https://github.com/AcalaNetwork/Acala/pull/2097

Although the xcm send from parachain first go to relaychain, then to Statemine, but the second xcm is use reserve instead of teleport.

zqhxuyuan avatar May 21 '22 05:05 zqhxuyuan

Thanks I'll have a look at your test

That said, using teleport is going to be far more cost effective than relay to statemine right?

Can we perhaps change the logic in Xtokens so that we

  1. Withdraw/burn asset from reserve account
  2. Notify relay to teleport assets to relay instead of reserve?

samelamin avatar May 21 '22 06:05 samelamin

I think it'll be better to add a new dispatch call for this case which use teleport. All the XTokens currently is using reserve model.

zqhxuyuan avatar May 24 '22 07:05 zqhxuyuan

No worries it sounds like you are supportive of the idea?

As soon as I have some time I'll start with a failing test so we define the interface and then we can go from there

samelamin avatar May 24 '22 09:05 samelamin

@zqhxuyuan doesn't this PR https://github.com/paritytech/cumulus/pull/1318 mean that the dispatchable with teleport is really needed now ?

ghzlatarev avatar Jun 17 '22 20:06 ghzlatarev

@zqhxuyuan doesn't this PR paritytech/cumulus#1318 mean that the dispatchable with teleport is really needed now ?

Yes, Indeed! This PR https://github.com/open-web3-stack/open-runtime-module-library/pull/785 support teleport but only for NonReserve case.

zqhxuyuan avatar Jun 27 '22 03:06 zqhxuyuan