Skip to content

Commit

Permalink
Darwinia integration for Moonbeam, fix for Crab in Moonriver (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello authored Oct 14, 2022
1 parent 837e86f commit d52c753
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 5 deletions.
38 changes: 38 additions & 0 deletions packages/config/src/config/moonbeam/assets/ring.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { AssetSymbol, ChainKey } from '../../../constants';
import { PolkadotXcmExtrinsicSuccessEvent } from '../../../extrinsic';
import {
assets,
balance,
chains,
extrinsic,
withdraw,
} from '../moonbeam.common';
import { MoonbeamXcmConfig } from '../moonbeam.interfaces';

const asset = assets[AssetSymbol.RING];
const origin = chains[ChainKey.Darwinia];

export const RING: MoonbeamXcmConfig = {
asset,
origin,
deposit: {
[origin.key]: {
origin,
balance: balance.system(),
extrinsic: extrinsic
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.X1(),
},
},
withdraw: {
[origin.key]: withdraw.xTokens({
balance: balance.system(),
destination: origin,
feePerWeight: 1_000_000_000,
}),
},
};
6 changes: 6 additions & 0 deletions packages/config/src/config/moonbeam/moonbeam.assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const MOONBEAM_ASSETS = <const>[
AssetSymbol.INTR,
AssetSymbol.PARA,
AssetSymbol.PHA,
AssetSymbol.RING,
AssetSymbol.USDT,
];

Expand Down Expand Up @@ -62,6 +63,11 @@ export const MOONBEAM_ASSETS_MAP: AssetsMap<MoonbeamAssets> = {
erc20Id: '0xffffffff63d24ecc8eb8a7b5d0803e900f7b6ced',
originSymbol: AssetSymbol.PHA,
},
[AssetSymbol.RING]: {
id: '125699734534028342599692732320197985871',
erc20Id: '0xffffffff5e90e365edca87fb4c8306df1e91464f',
originSymbol: AssetSymbol.RING,
},
[AssetSymbol.USDT]: {
id: '311091173110107856861649819128533077277',
erc20Id: '0xffffffffea09fb06d082fd1275cd48b191cbcd1d',
Expand Down
8 changes: 8 additions & 0 deletions packages/config/src/config/moonbeam/moonbeam.chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MoonbeamChains } from './moonbeam.interfaces';
export const MOONBEAM_CHAINS = <const>[
ChainKey.Acala,
ChainKey.Astar,
ChainKey.Darwinia,
ChainKey.Interlay,
ChainKey.Parallel,
ChainKey.Phala,
Expand All @@ -30,6 +31,13 @@ export const MOONBEAM_CHAINS_MAP: ChainsMap<MoonbeamChains> = {
moonAssetId: 18446744073709551619n,
palletInstance: 10,
},
[ChainKey.Darwinia]: {
key: ChainKey.Darwinia,
name: 'Darwinia',
ws: 'wss://parachain-rpc.darwinia.network',
weight: 1_000_000_000,
parachainId: 2046,
},
[ChainKey.Interlay]: {
key: ChainKey.Interlay,
name: 'Interlay',
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/config/moonbeam/moonbeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IBTC } from './assets/ibtc';
import { INTR } from './assets/intr';
import { PARA } from './assets/para';
import { PHA } from './assets/pha';
import { RING } from './assets/ring';
import { USDT } from './assets/usdt';

export const MOONBEAM_CONFIGS: MoonbeamXcmConfigs = {
Expand All @@ -22,5 +23,6 @@ export const MOONBEAM_CONFIGS: MoonbeamXcmConfigs = {
[AssetSymbol.INTR]: INTR,
[AssetSymbol.PARA]: PARA,
[AssetSymbol.PHA]: PHA,
[AssetSymbol.RING]: RING,
[AssetSymbol.USDT]: USDT,
};
4 changes: 2 additions & 2 deletions packages/config/src/config/moonriver/assets/crab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { MoonriverXcmConfig } from '../moonriver.interfaces';

const asset = assets[AssetSymbol.CRAB];
const origin = chains[ChainKey.Darwinia];
const origin = chains[ChainKey.Crab];

export const CRAB: MoonriverXcmConfig = {
asset,
Expand All @@ -32,7 +32,7 @@ export const CRAB: MoonriverXcmConfig = {
[origin.key]: withdraw.xTokens({
balance: balance.system(),
destination: origin,
feePerWeight: 8,
feePerWeight: 1_000_000_000,
}),
},
};
6 changes: 3 additions & 3 deletions packages/config/src/config/moonriver/moonriver.chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const MOONRIVER_CHAINS = <const>[
ChainKey.Bifrost,
ChainKey.Calamari,
ChainKey.CrustShadow,
ChainKey.Darwinia,
ChainKey.Crab,
ChainKey.Integritee,
ChainKey.Karura,
ChainKey.Khala,
Expand Down Expand Up @@ -40,8 +40,8 @@ export const MOONRIVER_CHAINS_MAP: ChainsMap<MoonriverChains> = {
weight: 1_000_000_000,
parachainId: 2012,
},
[ChainKey.Darwinia]: {
key: ChainKey.Darwinia,
[ChainKey.Crab]: {
key: ChainKey.Crab,
name: 'Darwinia Crab',
ws: 'wss://crab-parachain-rpc.darwinia.network',
weight: 1_000_000_000,
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/constants/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export enum AssetSymbol {
MOVR = 'MOVR',
PARA = 'PARA',
PHA = 'PHA',
RING = 'RING',
RMRK = 'RMRK',
SDN = 'SDN',
TEER = 'TEER',
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export enum ChainKey {
Bifrost = 'Bifrost',
Calamari = 'Calamari',
CloverAlphanet = 'CloverAlphanet',
Crab = 'Crab',
CrustShadow = 'CrustShadow',
CrustShadowAlphanet = 'CrustShadowAlphanet',
Darwinia = 'Darwinia',
Expand Down

0 comments on commit d52c753

Please sign in to comment.