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

Handle delegation of BRZ token to automation pallet in XCM config #358

Closed
ebma opened this issue Nov 29, 2023 · 2 comments · Fixed by #365
Closed

Handle delegation of BRZ token to automation pallet in XCM config #358

ebma opened this issue Nov 29, 2023 · 2 comments · Fixed by #365
Assignees

Comments

@ebma
Copy link
Member

ebma commented Nov 29, 2023

Context

The overall context for this is described in this Notion page.

When receiving an XCM transfer of BRZ tokens from Moonbeam that targets our automation pallet, we need to transfer the received BRZ tokens to the on-chain account of the automation pallet and call a function on it.

Implementation

We need to change the XCM config of our runtime so that it:

  1. is able to convert the MultiLocation of the incoming BRZ transfer from Moonbeam to a BRZ asset
  2. deposits the received tokens into the account of the automation pallet (exposed by its getPalletAccount() function)
  3. calls the processEurcOfframp() function on the pallet

Location of the BRZ asset on the CurrencyId enum

The BRZ asset is represented by CurrencyId::XCM(4), see here.

MultiLocation

The MultiLocation of the incoming BRZ transfer will have the following form:

MultiLocation: {
    parents: 1,
    interior: { X3: { 
       Parachain(2094),
       PalletInstance(xx), // will point to the automation pallet
       GeneralKey{ length: xx, data: []  }, // this will hold the reference number for Mykobo
},

Intercepting the XCM call

Since the MultiLocation of the incoming transfer needs to be handled a little different to other tokens, ie. the recipient account is defined by the automation pallet and we need to add extra logic so that we call the processEurcOfframp() function on the automation pallet for these transfers, it would be best to find some way to intercept the call entirely and not go down the usual route defined in the FungiblesTransactor.

It is not clear yet how exactly we need to change the types used in our XCM config to achieve this. Figuring this out is part of this ticket.

Passing the reference number

The processEurcOfframp() function needs to be called with the reference number that is contained in the MultiLocation. It is not clear yet how this reference number is going to look like so we need to use a placeholder for now.

@ebma
Copy link
Member Author

ebma commented Nov 29, 2023

@pendulum-chain/product this ticket is required for the EuroBrasil project. It changes our XCM config to be able to deal with the BRZ token. We should assign a high priority.

@prayagd
Copy link
Collaborator

prayagd commented Nov 30, 2023

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 a pull request may close this issue.

3 participants