paritytech / trappist

Apache License 2.0
81 stars 17 forks source link

Register Trappist native token on Rococo Asset Hub, and do some Foreign Assets examples #248

Open gautamdhameja opened 1 year ago

gautamdhameja commented 1 year ago

We need some examples for foreign asset functionality. Now that Trappist is on Rococo, let's try this out.

joepetrowski commented 1 year ago

Main paths to cover:

Extra Credit:

hbulgarini commented 12 months ago

This is perfectly doable. Below my thoughts:

  • Open an HRMP channel with Asset Hub.
  • Create the native token (TRAP?) on AH. You will need to construct a create call and send it using Trappist governance so that it comes from the Sovereign origin. Will need some ROC to cover the creation deposit.
  • Set the metadata for the asset. Again will need to come via governance (unless you set the admin to some other account in create, but let's consider that the "wrong" way of going about this). Again need some ROC for metadata deposit.

Ok! the native token of Trappist is HOP :)

Teleport TRAP to and from AH

For this we need to define a proper type over the IsTeleporter XCM config where Trappist recognize AH as a trusted teleporter. We might get the inspiration from the IsForeignConcreteAsset that is actually set on AH.

  • Use reserve backed transfers to send TRAP to other parachains, with AH acting as a reserve location.
  • Get another parachain on Rococo to copy you and send their PARA token to Trappist using reserve backed transfers. Demonstrate in Trappist how you handle a multi-reserve system: i.e. Trappist should recognize both AH and the PARA parachain as reserve locations for PARA.

Trappist project contains another runtime called Stout that can be used for this purpose, however we would need to deploy this one as well. Taking into account that the major amount of work for having a proper deployment of the parachain was already done for Trappist, deploying Stout on Rococo shouldn't be so time consuming.

Something interesting is that Stout (as well Trappist) recognize AH as an asset reserve : https://github.com/paritytech/trappist/blob/main/runtime/stout/src/xcm_config.rs#L205:L221

Also Stout contains a DEX, so we could go further and create a liquidity pool composed by the reserved HOP on AH and Rockmine USD (id: 1984). We might want also to define some showcases with more advanced cross-chain interactions by leveraging the Transact instruction.

joepetrowski commented 12 months ago

Also Stout contains a DEX

So does AH.

hbulgarini commented 12 months ago

So does AH.

  • Get another parachain on Rococo to copy you and send their PARA token to Trappist using reserve backed transfers. Demonstrate in Trappist how you handle a multi-reserve system: i.e. Trappist should recognize both AH and the PARA parachain as reserve locations for PARA.

The usage of the DEX on Stout specifically would fill that item, is not intended to replace any interaction with the asset convertion pallet on AH which would be done as well.

joepetrowski commented 12 months ago

What does that point have to do with a DEX? They are completely unrelated.

stiiifff commented 12 months ago

@hbulgarini Let's not bring another DEX into the conversation .. that's a bit confusing. @joepetrowski Looks like we've got all that's needed to build this example on "Trappist on Rococo". Let's have a quick sync internally to align, and we'll then proceed with this 🥳️🚀️

metricaez commented 7 months ago

Hi! As an update on this we have already covered from the registration to the teleport in and there is currently a HOP/ROC pool created on AH.

  [
    [
      [
        {
          parents: 1
          interior: Here
        }
        {
          parents: 1
          interior: {
            X1: {
              Parachain: 1,836
            }
          }
        }
      ]
    ]
    {
      lpToken: 11
    }
  ]