Skip to content

Commit

Permalink
feat: ParaToEthereum (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
marshacb authored Dec 19, 2024
1 parent 3be6c47 commit 4a61925
Show file tree
Hide file tree
Showing 35 changed files with 3,632 additions and 1,443 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
**/lib/*
**/build/*


1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const config = require('@substrate/dev/config/eslint');

module.exports = {
...config,
parser: "@typescript-eslint/parser",
parserOptions: {
project: '**/tsconfig.json',
},
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ The below chart is focusing on what directions are supported for constructing as
| Parachain to Parachain ||||
| Parachain to Relay ||||
| Parachain to System ||||

## Note on Parachain to Parachain Support

Parachain To Parachain support is currently limited to XCM V2, with the exception of Parachain primary asset tx construction (e.g. MOVR, SDN, etc.).
| Parachain to Ethereum ||||

## Note: System refers to System Parachains like Asset Hub.

Expand Down
147 changes: 147 additions & 0 deletions e2e-tests/__snapshots__/hydration.ethereum.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Hydration <> Ethereum > XCM V3 > Transfer Snowbridge WETH from Hydration to Ethereum > assetHub xcmp message sent 1`] = `
[
{
"data": {
"messageHash": "(hash)",
},
"method": "XcmpMessageSent",
"section": "xcmpQueue",
},
]
`;

exports[`Hydration <> Ethereum > XCM V3 > Transfer Snowbridge WETH from Hydration to Ethereum > assethub foreign assets burned 1`] = `
[
{
"data": {
"assetId": {
"interior": {
"X2": [
{
"GlobalConsensus": {
"Ethereum": {
"chainId": 1,
},
},
},
{
"AccountKey20": {
"key": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"network": null,
},
},
],
},
"parents": 2,
},
"balance": 75000000000000,
"owner": "13cKp89Uh2yWgTG28JA1QEvPUMjEPKejqkjHKf9zqLiFKjH6",
},
"method": "Burned",
"section": "foreignAssets",
},
]
`;

exports[`Hydration <> Ethereum > XCM V3 > Transfer Snowbridge WETH from Hydration to Ethereum > bridgehub ethereum outbound queue events 1`] = `
[
{
"data": {
"id": 0,
},
"method": "MessageQueued",
"section": "ethereumOutboundQueue",
},
{
"data": {
"id": 0,
"nonce": "(redacted)",
},
"method": "MessageAccepted",
"section": "ethereumOutboundQueue",
},
{
"data": {
"count": 1,
"root": "(hash)",
},
"method": "MessagesCommitted",
"section": "ethereumOutboundQueue",
},
]
`;

exports[`Hydration <> Ethereum > XCM V4 > Transfer Snowbridge WETH from Hydration to Ethereum > assetHub xcmp message sent 1`] = `
[
{
"data": {
"messageHash": "(hash)",
},
"method": "XcmpMessageSent",
"section": "xcmpQueue",
},
]
`;

exports[`Hydration <> Ethereum > XCM V4 > Transfer Snowbridge WETH from Hydration to Ethereum > assethub foreign assets burned 1`] = `
[
{
"data": {
"assetId": {
"interior": {
"X2": [
{
"GlobalConsensus": {
"Ethereum": {
"chainId": 1,
},
},
},
{
"AccountKey20": {
"key": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"network": null,
},
},
],
},
"parents": 2,
},
"balance": 75000000000000,
"owner": "13cKp89Uh2yWgTG28JA1QEvPUMjEPKejqkjHKf9zqLiFKjH6",
},
"method": "Burned",
"section": "foreignAssets",
},
]
`;

exports[`Hydration <> Ethereum > XCM V4 > Transfer Snowbridge WETH from Hydration to Ethereum > bridgehub ethereum outbound queue events 1`] = `
[
{
"data": {
"id": 0,
},
"method": "MessageQueued",
"section": "ethereumOutboundQueue",
},
{
"data": {
"id": 0,
"nonce": "(redacted)",
},
"method": "MessageAccepted",
"section": "ethereumOutboundQueue",
},
{
"data": {
"count": 1,
"root": "(hash)",
},
"method": "MessagesCommitted",
"section": "ethereumOutboundQueue",
},
]
`;
39 changes: 39 additions & 0 deletions e2e-tests/__snapshots__/moonbeam.hydration.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Moonbeam <> Hydration > XCM V3 > Transfer GLMR from Moonbeam to Hydration > hydration recipients initial glmr balance 1`] = `
{
"free": 0,
"frozen": 0,
"reserved": 0,
}
`;

exports[`Moonbeam <> Hydration > XCM V3 > Transfer GLMR from Moonbeam to Hydration > hydration recipients updated glmr balance 1`] = `
{
"free": "(rounded 10000000000000000000)",
"frozen": 0,
"reserved": 0,
}
`;

exports[`Moonbeam <> Hydration > XCM V3 > Transfer HDX from Hydration to Moonbeam > moonbeam recipients initial hdx balance 1`] = `
{
"balance": 0,
"extra": null,
"reason": {
"consumer": null,
},
"status": "Liquid",
}
`;

exports[`Moonbeam <> Hydration > XCM V3 > Transfer HDX from Hydration to Moonbeam > moonbeam recipients updated hdx balance 1`] = `
{
"balance": "(rounded 10000000000000000)",
"extra": null,
"reason": {
"sufficient": null,
},
"status": "Liquid",
}
`;
57 changes: 57 additions & 0 deletions e2e-tests/__snapshots__/polkadotAssetHub.bridgeHub.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Polkadot AssetHub <> Ethereum > XCM V3 > Snowbridge WETH From AssetHub to Ethereum > bridgehub ethereum outbound queue events 1`] = `
[
{
"data": {
"id": "(hash)",
},
"method": "MessageQueued",
"section": "ethereumOutboundQueue",
},
{
"data": {
"id": "(hash)",
"nonce": "(redacted)",
},
"method": "MessageAccepted",
"section": "ethereumOutboundQueue",
},
{
"data": {
"count": 1,
"root": "(hash)",
},
"method": "MessagesCommitted",
"section": "ethereumOutboundQueue",
},
]
`;

exports[`Polkadot AssetHub <> Ethereum > XCM V4 > Snowbridge WETH From AssetHub to Ethereum > bridgehub ethereum outbound queue events 1`] = `
[
{
"data": {
"id": "(hash)",
},
"method": "MessageQueued",
"section": "ethereumOutboundQueue",
},
{
"data": {
"id": "(hash)",
"nonce": "(redacted)",
},
"method": "MessageAccepted",
"section": "ethereumOutboundQueue",
},
{
"data": {
"count": 1,
"root": "(hash)",
},
"method": "MessagesCommitted",
"section": "ethereumOutboundQueue",
},
]
`;
Loading

0 comments on commit 4a61925

Please sign in to comment.