Skip to content
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

Allow reserve asset transfer of relaychain token to parachain and back #260

Closed
wants to merge 14 commits into from

Conversation

brenzi
Copy link
Collaborator

@brenzi brenzi commented Feb 9, 2024

first step to bring TEER to Asset Hub is to bring KSM to Integritee (to pay xcm fees with)

This PR allows to

  • reserve asset transfer KSM from relaychain to Integritee
  • reserve asset transfer KSM from integritee to relaychain

the chosen solutions are inspired from Karura and Trappist

  • add orml_tokens (but don't expose its dispatchables)
  • add orml_currencies
  • modify XCM Barrier
  • modify XCM Trader

sanity checks:

  • tokens are hardcoded. only runtime-upgrade can add more fungible tokens
  • currencies.updateBalance yields BadOrigin for users

do not merge just yet

This PR makes a design decision that we may want to iterate on!

  • use orml pallets instead of polkadot-sdk pallet_assets because the latter is more generic and powerful than necessary
  • hard-code all assets and mappings to MultiLocation
    • this may cause more work in the future, if we would like to maintain the single-runtime for Kusama and Polkadot policy
    • also causes more maintance work (should we decide to host USDC/USDT as well

testing

start zombienet

zombienet-linux-x64 spawn --provider native zombienet/rococo-local-with-integritee.toml

send 1 ROC from relaychain to integritee network

0x6308030001007d1f0300010100d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d030400000000070010a5d4e80000000000

you should see tokens.Deposited Event on Integritee Network

check balance:
image

send funds from Alice to Bob

send ROC back from Bob to Bob on relaychain

@brenzi brenzi changed the title Allow reserve asset transfer of KSM to parachain Allow reserve asset transfer of relaychain token to parachain and back Feb 9, 2024
pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {
match currency_id {
CurrencyId::TEER => MILLITEER,
CurrencyId::RelayNative => 3_333_333u128.into() // keep this with asset hub ED
Copy link
Collaborator Author

@brenzi brenzi Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nicer to call this KSM, but as we want to have one runtime for KSM and DOT, we may keep it generic RelayNative

@@ -861,10 +921,6 @@ mod benches {
[pallet_child_bounties, ChildBounties]
[pallet_claims, Claims]
[pallet_collective, Council]
// Fixme #177: For some reason the benchmarks write both to the same pallet_collective weight
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no reason to fix this. of course the benchmark is the same for two instances of the same pallet

_ => None,
},
MultiLocation { parents, interior } if parents == 0 => match interior {
X1(junction) if junction == TEER_GENERAL_KEY => Some(CurrencyId::TEER),
Here => Some(CurrencyId::TEER),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll need that because that will be how Asset Hub refers to TEER (different from Karura, Moonriver style)

@brenzi brenzi requested a review from clangenb February 9, 2024 09:19
@brenzi brenzi mentioned this pull request Feb 9, 2024
3 tasks
@brenzi brenzi marked this pull request as draft February 11, 2024 08:38
@brenzi brenzi removed the request for review from clangenb February 11, 2024 08:38
@brenzi
Copy link
Collaborator Author

brenzi commented Feb 11, 2024

orml_tokens / orml_currencies do not implement AccountTouch nor ContainsPair traits which are needed for pallet_asset_conversion

I guess the decision to use ORML for this was wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant