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

Add Asset Hub Flow #283

Open
TorstenStueber opened this issue Nov 14, 2024 · 8 comments · May be fixed by #284
Open

Add Asset Hub Flow #283

TorstenStueber opened this issue Nov 14, 2024 · 8 comments · May be fixed by #284
Assignees

Comments

@TorstenStueber
Copy link
Member

For offramping Asset Hub USDC, we need to implement a new flow structure that starts with the Asset Hub.

Different flow structures will also imply that other parts of the code are more generic, e.g., the OfframpingState type.

Proposal

  • for simplicity, we can just reuse the current definition of OfframpingState for the new flow
    • squidRouterApproveHash, squidRouterSwapHash, moonbeamXcmTransactionHash will not be required but they are defined as optional anyway
    • squidRouterReceiverId and squidRouterReceiverHash are determined in constructInitialState
      but we can keep this logic as we can use it to show a unique id to the user (Update transaction ID shown to the user #193)
  • add a new field to OfframpingState that describes the type of flow (e.g., "type": "evmMoonbeam" | "assetHub")
  • add a new phase assetHubXcm and a handler
  • remove the initial wait for the squidRouterSwapHash evm transaction from the pendulumFundEphemeral phase handler
  • in prepareTransactions phase handler proceed to
    • phase squidRouter if state.type === "evmMoonbeam"
    • phase pendulumFundEphemeral if state.type === "assetHub"
  • in pendulumFundEphemeral phase handler proceed to
    • phase executeXCM if state.type === "evmMoonbeam"
    • phase assetHubXcm if state.type === "assetHub"

Note

The new flow structure is not explicitly defined in the file src/services/offrampingFlow.ts but implicitly defined by the successor phase returned in every phase handler.

Whereas the initial structure of the evm-moonbeam flow is:

  • prepareTransactions
  • squidRouter
  • pendulumFundEphemeral
  • executeXCM
  • subsidizePreSwap

the structure for the Asset Hub flow is:

  • prepareTransactions
  • pendulumFundEphemeral
  • assetHubXcm
  • subsidizePreSwap
@TorstenStueber
Copy link
Member Author

Hey team! Please add your planning poker estimate with Zenhub @ebma @gianfra-t @Sharqiewicz

@TorstenStueber
Copy link
Member Author

To be discussed: how identify the Asset Hub user and derive the memo for sep10 (#257)

@ebma
Copy link
Member

ebma commented Nov 14, 2024

We can use the same function @gianfra-t implemented for the EVM accounts and just pass the Polkadot address. We need to make sure that we pass the addresses using the same ss58 encoding and we don't mix it up ending with different memos for the same account.

@TorstenStueber
Copy link
Member Author

That makes sense, but I also meant the signing part. Do Polkadot wallets also have a standardized API to sign arbitrary messages? (I guess so, this happens on Polkassembly for example).

@gianfra-t
Copy link
Contributor

I think so, we will use also the talisman package as in the portal right? In the only example of the package they show a message sign.

@TorstenStueber
Copy link
Member Author

I am not familiar with the Talisman package. That works with every Polkadot wallet, not just with Talisman?

@gianfra-t
Copy link
Contributor

If I understand correctly, yes, it's our wagmi for Polkadot on the Portal.

@ebma
Copy link
Member

ebma commented Nov 14, 2024

Polkadot.js supports signing arbitrary messages, see the docs here. As we can't do const alice = keyring.addFromUri('//Alice'); but instead need to access the signer from the wallet, we can use talisman for that. But this is quite straightforward so once #271 is added and a polkadot signer is available, it's just a simple function call.

@ebma ebma self-assigned this Nov 15, 2024
@ebma ebma linked a pull request Nov 18, 2024 that will close this issue
2 tasks
@ebma ebma linked a pull request Nov 18, 2024 that will close this issue
2 tasks
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