Skip to content

Commit

Permalink
XCM: Fix wormhole asset keys
Browse files Browse the repository at this point in the history
  • Loading branch information
nohaapav committed Nov 15, 2023
1 parent b7f147a commit 1bb96f6
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 67 deletions.
36 changes: 18 additions & 18 deletions packages/xcm/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@ import { aca, astr, bnc, cfg, dai, dot, glmr, hdx, ibtc, usdt, wbtc, weth, ztg }

export { aca, astr, bnc, cfg, dot, glmr, hdx, ibtc, usdt, ztg };

export const daiAcala = new Asset({
export const dai_awh = new Asset({
...dai,
key: 'dai-acala',
key: 'dai_awh',
});

export const daiMoonbeam = new Asset({
export const dai_mwh = new Asset({
...dai,
key: 'dai-moonbeam',
key: 'dai_mwh',
});

export const wethAcala = new Asset({
export const weth_awh = new Asset({
...weth,
key: 'weth-acala',
key: 'weth_awh',
});

export const wethMoonbeam = new Asset({
export const weth_mwh = new Asset({
...weth,
key: 'weth-moonbeam',
key: 'weth_mwh',
});

export const wbtcAcala = new Asset({
export const wbtc_awh = new Asset({
...wbtc,
key: 'wbtc-acala',
key: 'wbtc_awh',
});

export const wbtcMoonbeam = new Asset({
export const wbtc_mwh = new Asset({
...wbtc,
key: 'wbtc-moonbeam',
key: 'wbtc_mwh',
});

export const assets: Asset[] = [
aca,
astr,
cfg,
bnc,
daiAcala,
daiMoonbeam,
dai_awh,
dai_mwh,
dot,
glmr,
hdx,
ibtc,
usdt,
wbtcAcala,
wbtcMoonbeam,
wethAcala,
wethMoonbeam,
wbtc_awh,
wbtc_mwh,
weth_awh,
weth_mwh,
ztg,
];

Expand Down
39 changes: 19 additions & 20 deletions packages/xcm/src/chains.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnyChain, Ecosystem, EvmParachain, Parachain } from '@moonbeam-network/xcm-types';
import { AnyChain, EvmParachain, Parachain } from '@moonbeam-network/xcm-types';
import {
acala as defaultAcala,
astar as defaultAstar,
Expand All @@ -17,17 +17,17 @@ import {
astr,
bnc,
cfg,
daiAcala,
daiMoonbeam,
dai_awh,
dai_mwh,
dot,
glmr,
hdx,
ibtc,
usdt,
wbtcAcala,
wbtcMoonbeam,
wethAcala,
wethMoonbeam,
wbtc_awh,
wbtc_mwh,
weth_awh,
weth_mwh,
ztg,
} from './assets';

Expand All @@ -40,17 +40,17 @@ export const acala = new Parachain({
metadataId: { NativeAssetId: { Token: aca.originSymbol } },
},
{
asset: daiAcala,
asset: dai_awh,
balanceId: '0x54a37a01cd75b616d63e0ab665bffdb0143c52ae',
id: { Erc20: '0x54a37a01cd75b616d63e0ab665bffdb0143c52ae' },
},
{
asset: wbtcAcala,
asset: wbtc_awh,
balanceId: '0xc80084af223c8b598536178d9361dc55bfda6818',
id: { Erc20: '0xc80084af223c8b598536178d9361dc55bfda6818' },
},
{
asset: wethAcala,
asset: weth_awh,
balanceId: '0x5a4d6acdc4e3e5ab15717f407afe957f7a242578',
id: { Erc20: '0x5a4d6acdc4e3e5ab15717f407afe957f7a242578' },
},
Expand Down Expand Up @@ -104,7 +104,6 @@ export const centrifuge = new Parachain({
export const hydraDX = new Parachain({
...defaultHydraDx,
key: 'hydradx',
//ws: 'wss://hydradx-rpc.dwellir.com',
assetsData: [
{
asset: astr,
Expand All @@ -123,11 +122,11 @@ export const hydraDX = new Parachain({
id: 5,
},
{
asset: daiAcala,
asset: dai_awh,
id: 2,
},
{
asset: daiMoonbeam,
asset: dai_mwh,
id: 18,
},
{
Expand All @@ -150,19 +149,19 @@ export const hydraDX = new Parachain({
palletInstance: 50,
},
{
asset: wbtcAcala,
asset: wbtc_awh,
id: 3,
},
{
asset: wbtcMoonbeam,
asset: wbtc_mwh,
id: 19,
},
{
asset: wethAcala,
asset: weth_awh,
id: 4,
},
{
asset: wethMoonbeam,
asset: weth_mwh,
id: 20,
},
{
Expand All @@ -188,7 +187,7 @@ export const moonbeam = new EvmParachain({
...defaultMoonbeam,
assetsData: [
{
asset: daiMoonbeam,
asset: dai_mwh,
id: '0x06e605775296e851FF43b4dAa541Bb0984E9D6fD',
metadataId: 0,
},
Expand All @@ -202,12 +201,12 @@ export const moonbeam = new EvmParachain({
id: '69606720909260275826784788104880799692',
},
{
asset: wbtcMoonbeam,
asset: wbtc_mwh,
id: '0xE57eBd2d67B462E9926e04a8e33f01cD0D64346D',
metadataId: 0,
},
{
asset: wethMoonbeam,
asset: weth_mwh,
id: '0xab3f0245B83feB11d15AAffeFD7AD465a59817eD',
metadataId: 0,
},
Expand Down
14 changes: 7 additions & 7 deletions packages/xcm/src/configs/acala.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BalanceBuilder } from '@moonbeam-network/xcm-builder';
import { AssetConfig, ChainConfig } from '@moonbeam-network/xcm-config';

import { daiAcala, wbtcAcala, wethAcala } from '../assets';
import { dai_awh, wbtc_awh, weth_awh } from '../assets';
import { hydraDX, acala } from '../chains';
import { ExtrinsicBuilderV3 } from '../builders';

Expand All @@ -12,36 +12,36 @@ const toEvmAddress = async (api: any, address: string) => {

const toHydraDX: AssetConfig[] = [
new AssetConfig({
asset: daiAcala,
asset: dai_awh,
balance: BalanceBuilder().evm().erc20(),
destination: hydraDX,
destinationFee: {
amount: 0.002926334210356268,
asset: daiAcala,
asset: dai_awh,
balance: BalanceBuilder().evm().erc20(),
},
extrinsic: ExtrinsicBuilderV3().xTokens().transfer(),
//toEvmAddress,
}),
new AssetConfig({
asset: wbtcAcala,
asset: wbtc_awh,
balance: BalanceBuilder().evm().erc20(),
destination: hydraDX,
destinationFee: {
amount: 0.00000006,
asset: wbtcAcala,
asset: wbtc_awh,
balance: BalanceBuilder().evm().erc20(),
},
extrinsic: ExtrinsicBuilderV3().xTokens().transfer(),
//toEvmAddress,
}),
new AssetConfig({
asset: wethAcala,
asset: weth_awh,
balance: BalanceBuilder().evm().erc20(),
destination: hydraDX,
destinationFee: {
amount: 0.000000956965470918,
asset: wethAcala,
asset: weth_awh,
balance: BalanceBuilder().evm().erc20(),
},
extrinsic: ExtrinsicBuilderV3().xTokens().transfer(),
Expand Down
30 changes: 15 additions & 15 deletions packages/xcm/src/configs/hydraDX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,52 @@ import {
astr,
bnc,
cfg,
daiAcala,
daiMoonbeam,
dai_awh,
dai_mwh,
dot,
glmr,
hdx,
ibtc,
usdt,
wbtcAcala,
wbtcMoonbeam,
wethAcala,
wethMoonbeam,
wbtc_awh,
wbtc_mwh,
weth_awh,
weth_mwh,
ztg,
} from '../assets';
import { acala, assetHub, astar, bifrost, centrifuge, hydraDX, interlay, moonbeam, zeitgeist } from '../chains';
import { ExtrinsicBuilderV3 } from '../builders';

const toAcala: AssetConfig[] = [
new AssetConfig({
asset: daiAcala,
asset: dai_awh,
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: acala,
destinationFee: {
amount: 0.00092696,
asset: daiAcala,
asset: dai_awh,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
extrinsic: ExtrinsicBuilderV3().xTokens().transfer(),
}),
new AssetConfig({
asset: wbtcAcala,
asset: wbtc_awh,
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: acala,
destinationFee: {
amount: 0.00000004,
asset: wbtcAcala,
asset: wbtc_awh,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
extrinsic: ExtrinsicBuilderV3().xTokens().transfer(),
}),
new AssetConfig({
asset: wethAcala,
asset: weth_awh,
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: acala,
destinationFee: {
amount: 0.000000687004,
asset: wethAcala,
asset: weth_awh,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
extrinsic: ExtrinsicBuilderV3().xTokens().transfer(),
Expand Down Expand Up @@ -151,7 +151,7 @@ const toMoonbeam: AssetConfig[] = [
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
}),
new AssetConfig({
asset: daiMoonbeam,
asset: dai_mwh,
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: moonbeam,
destinationFee: {
Expand All @@ -166,7 +166,7 @@ const toMoonbeam: AssetConfig[] = [
},
}),
new AssetConfig({
asset: wbtcMoonbeam,
asset: wbtc_mwh,
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: moonbeam,
destinationFee: {
Expand All @@ -181,7 +181,7 @@ const toMoonbeam: AssetConfig[] = [
},
}),
new AssetConfig({
asset: wethMoonbeam,
asset: weth_mwh,
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: moonbeam,
destinationFee: {
Expand Down
14 changes: 7 additions & 7 deletions packages/xcm/src/configs/moonbeam.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BalanceBuilder, ContractBuilder } from '@moonbeam-network/xcm-builder';
import { AssetConfig, ChainConfig } from '@moonbeam-network/xcm-config';

import { daiMoonbeam, glmr, hdx, wbtcMoonbeam, wethMoonbeam } from '../assets';
import { dai_mwh, glmr, hdx, wbtc_mwh, weth_mwh } from '../assets';
import { hydraDX, moonbeam } from '../chains';

const toHydraDX: AssetConfig[] = [
Expand All @@ -21,13 +21,13 @@ const toHydraDX: AssetConfig[] = [
},
}),
new AssetConfig({
asset: daiMoonbeam,
asset: dai_mwh,
balance: BalanceBuilder().evm().erc20(),
contract: ContractBuilder().Xtokens().transfer(),
destination: hydraDX,
destinationFee: {
amount: 0.004,
asset: daiMoonbeam,
asset: dai_mwh,
balance: BalanceBuilder().evm().erc20(),
},
fee: {
Expand All @@ -36,13 +36,13 @@ const toHydraDX: AssetConfig[] = [
},
}),
new AssetConfig({
asset: wbtcMoonbeam,
asset: wbtc_mwh,
balance: BalanceBuilder().evm().erc20(),
contract: ContractBuilder().Xtokens().transfer(),
destination: hydraDX,
destinationFee: {
amount: 0.0000001,
asset: wbtcMoonbeam,
asset: wbtc_mwh,
balance: BalanceBuilder().evm().erc20(),
},
fee: {
Expand All @@ -51,13 +51,13 @@ const toHydraDX: AssetConfig[] = [
},
}),
new AssetConfig({
asset: wethMoonbeam,
asset: weth_mwh,
balance: BalanceBuilder().evm().erc20(),
contract: ContractBuilder().Xtokens().transfer(),
destination: hydraDX,
destinationFee: {
amount: 0.000002,
asset: wethMoonbeam,
asset: weth_mwh,
balance: BalanceBuilder().evm().erc20(),
},
fee: {
Expand Down

0 comments on commit 1bb96f6

Please sign in to comment.