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

J2 mrl #707

Merged
merged 11 commits into from
Aug 18, 2023
Merged

J2 mrl #707

merged 11 commits into from
Aug 18, 2023

Conversation

jboetticher
Copy link
Contributor

Description

Adds documentation on MRL for parachains who want to start an integration.

Checklist

  • If this requires translations for the moonbeam-docs-cn repo, I have created a ticket for the translations in Jira
  • If this page requires a disclaimer, I have added one

Corresponding PRs

Please link to any corresponding PRs here.

After Translation Requirements

  • Will need to create PR in moonbeam-docs repo to remove images
  • Will need to create PR in moonbeam-docs repo to remove variables
  • Will need to create PR in moonbeam-mkdocs repo to add redirects for Chinese site
  • No additional PRs are required after the translations are done

Items to be Updated

Please list any of the items that will need to be added or deleted after the translations are done here.

@eshaben
Copy link
Contributor

eshaben commented Jul 31, 2023

thanks @jboetticher !!

@eshaben eshaben changed the base branch from master to eshaben/j2-mrl July 31, 2023 13:51
@jboetticher jboetticher marked this pull request as ready for review August 1, 2023 18:00
Copy link
Contributor

@eshaben eshaben left a comment

Choose a reason for hiding this comment

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

just had a few questions on this!

--8<-- 'code/mrl/transfer-multiassets.js'
```

To generate the second end of the transaction (remote EVM call), you need both the EVM transaction and the XCM instructions that executes said EVM transaction. The EVM transaction can be constructed as a transaction that interacts with the [batch precompile](/builders/pallets-precompiles/precompiles/batch){target=_blank} so that two transactions can happen in one. This is helpful because this EVM transaction has to both approve the xLabs relayer to relay the ERC-20 token as well as relay action itself.
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be any relayer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, any relayer. Relayers are trustless

const moonbeamProvider = new WsProvider(MOONBEAM_CHAIN_WS_ENDPOINT);
const moonbeamAPI = await ApiPromise.create({ provider: moonbeamProvider });

const ethereumTx = await batchApproveTransferTx(moonbeamAPI);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is calling the function created in the evm-tx.js file, right?

Copy link
Contributor Author

@jboetticher jboetticher Aug 15, 2023

Choose a reason for hiding this comment

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

Yes. They're meant to be sequential but combined

{ V3: { parents: new BN(1), interior: { X1: { Parachain: 1000 } } } },
{
V3: [
// Withdraw DEV asset (0.06) from the target account
Copy link
Contributor

Choose a reason for hiding this comment

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

why 0.06 DEV? does this number come from somewhere specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's a slight overestimation for what is required. It's just enough to pay for EVM tx gas and XCM fees


If you would like to see an example script that fully implements this, an example is available in a [GitHub repository](https://github.com/jboetticher/mrl-reverse){target=_blank}.

It’s important to note that not every parachain will have xTokens and the other pallets implemented in a way that will allow this path. Substrate-based chains are very flexible, to the point where a standard doesn’t exist. If you believe your parachain does not support this path, please provide an alternative solution in the Moonbeam forum and to the Wormhole team.
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a preferred contact method for the Wormhole team?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure. You could reach out directly through telegram or discord, but the best way is potentially through us instead of directly to the Wormhole team.


While Wormhole has the technical capability to bridge any token across chains, relayers will not support every token for fees. The ERC-20 assets that can be bridged through Wormhole's MRL solution are dependent on the tokens that the [xLabs relayer](https://xlabs.xyz/){target=_blank} takes in. The tokens that are available to Moonbeam are listed in the table below:

| Token Name | Address |
Copy link
Contributor

Choose a reason for hiding this comment

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

these are just addresses for Moonbeam, right? what about Moonriver and Moonbase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe Moonriver is supported. Unsure of what is supported for Moonbase Alpha, as their relayer doesn't necessarily do testnet transactions in my experience. I have asked.

const WrappedFTM = new ethers.utils.Interface(abi.IERC20);
// https://github.com/wormhole-foundation/example-token-bridge-relayer/blob/main/evm/src/token-bridge-relayer/TokenBridgeRelayer.sol
const TokenRelayer = new ethers.Contract(
XLABS_RELAYER_ADDRESS,
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the xLabs relayer address?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moonbase Alpha: 0x9563a59c15842a6f322b10f69d1dd88b41f2e97b
Moonbeam: 0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca

@eshaben eshaben merged commit db1b7ac into moonbeam-foundation:eshaben/j2-mrl Aug 18, 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 this pull request may close these issues.

2 participants