From c5dbedc1a1476a00d50e58b06a1c45470d766511 Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Fri, 29 Dec 2023 22:44:39 +1300 Subject: [PATCH] Pendulum integration with Moonbeam (#176) * -wip- initial commit * fix genesis hash and ss58 * apply unlimited weight to precompile calls * revert changes in settings test * change script execution * add changeset * install bun for scripts * remove ts-node from tsconfig * revert tsconfig changes * Pendulum - Moonbeam config * finish config * remove changeset * add changeset --- .changeset/dirty-buckets-relax.md | 6 ++++ packages/config/src/assets.ts | 6 ++++ packages/config/src/chains.ts | 29 +++++++++++++++++ packages/config/src/configs/index.ts | 2 ++ packages/config/src/configs/moonbeam.ts | 28 +++++++++++++++++ packages/config/src/configs/pendulum.ts | 41 +++++++++++++++++++++++++ 6 files changed, 112 insertions(+) create mode 100644 .changeset/dirty-buckets-relax.md create mode 100644 packages/config/src/configs/pendulum.ts diff --git a/.changeset/dirty-buckets-relax.md b/.changeset/dirty-buckets-relax.md new file mode 100644 index 00000000..10dc189e --- /dev/null +++ b/.changeset/dirty-buckets-relax.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-config': patch +'@moonbeam-network/xcm-sdk': patch +--- + +Pendulum integration with Moonbeam diff --git a/packages/config/src/assets.ts b/packages/config/src/assets.ts index cc0da809..c23b67bc 100644 --- a/packages/config/src/assets.ts +++ b/packages/config/src/assets.ts @@ -180,6 +180,11 @@ export const paring = new Asset({ originSymbol: 'PARING', }); +export const pen = new Asset({ + key: 'pen', + originSymbol: 'PEN', +}); + export const pha = new Asset({ key: 'pha', originSymbol: 'PHA', @@ -346,6 +351,7 @@ export const assetsList: Asset[] = [ otp, para, paring, + pen, pha, pica, ring, diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 6ba801b2..3eda27a3 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -41,6 +41,7 @@ import { otp, para, paring, + pen, pha, pica, ring, @@ -873,6 +874,10 @@ export const moonbeam = new EvmParachain({ asset: pha, id: '132685552157663328694213725410064821485', }, + { + asset: pen, + id: '45647473099451451833602657905356404688', + }, { asset: ring, id: '125699734534028342599692732320197985871', @@ -1155,6 +1160,29 @@ export const parallelHeiko = new Parachain({ ws: 'wss://heiko-rpc.parallel.fi', }); +export const pendulum = new Parachain({ + assetsData: [ + { + asset: pen, + id: 'Native', + metadataId: 0, + }, + { + asset: glmr, + decimals: 18, + id: { XCM: 6 }, + }, + ], + ecosystem: Ecosystem.Polkadot, + genesisHash: + '0x5d3c298622d5634ed019bf61ea4b71655030015bde9beb0d6a24743714462c86', + key: 'pendulum', + name: 'Pendulum', + parachainId: 2094, + ss58Format: 56, + ws: 'wss://rpc-pendulum.prd.pendulumchain.tech', +}); + export const pendulumAlphanet = new Parachain({ assetsData: [ { @@ -1447,6 +1475,7 @@ export const chainsList: AnyChain[] = [ originTrailAlphanet, parallel, parallelHeiko, + pendulum, pendulumAlphanet, phala, picasso, diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index f1597b49..1a09e5d9 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -34,6 +34,7 @@ import { originTrailConfig } from './originTrail'; import { originTrailAlphanetConfig } from './originTrailAlphanet'; import { parallelConfig } from './parallel'; import { parallelHeikoConfig } from './parallelHeiko'; +import { pendulumConfig } from './pendulum'; import { pendulumAlphanetConfig } from './pendulumAlphanet'; import { phalaConfig } from './phala'; import { picassoConfig } from './picasso'; @@ -81,6 +82,7 @@ export const chainsConfigList: ChainConfig[] = [ originTrailAlphanetConfig, parallelConfig, parallelHeikoConfig, + pendulumConfig, pendulumAlphanetConfig, phalaConfig, picassoConfig, diff --git a/packages/config/src/configs/moonbeam.ts b/packages/config/src/configs/moonbeam.ts index ea6c8878..3d9c281e 100644 --- a/packages/config/src/configs/moonbeam.ts +++ b/packages/config/src/configs/moonbeam.ts @@ -18,6 +18,7 @@ import { nodl, otp, para, + pen, pha, ring, sub, @@ -45,6 +46,7 @@ import { nodle, originTrail, parallel, + pendulum, phala, polkadot, polkadotAssetHub, @@ -144,6 +146,17 @@ export const moonbeamConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: pendulum, + destinationFee: { + amount: 0.0002, // + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: aca, balance: BalanceBuilder().substrate().assets().account(), @@ -354,6 +367,21 @@ export const moonbeamConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: pen, + balance: BalanceBuilder().substrate().assets().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: pendulum, + destinationFee: { + amount: 0.01, + asset: pen, + balance: BalanceBuilder().substrate().assets().account(), + }, + fee: { + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: pha, balance: BalanceBuilder().substrate().assets().account(), diff --git a/packages/config/src/configs/pendulum.ts b/packages/config/src/configs/pendulum.ts new file mode 100644 index 00000000..a8876599 --- /dev/null +++ b/packages/config/src/configs/pendulum.ts @@ -0,0 +1,41 @@ +import { + BalanceBuilder, + ExtrinsicBuilder, + FeeBuilder, +} from '@moonbeam-network/xcm-builder'; +import { glmr, pen } from '../assets'; +import { moonbeam, pendulum } from '../chains'; +import { AssetConfig } from '../types/AssetConfig'; +import { ChainConfig } from '../types/ChainConfig'; + +export const pendulumConfig = new ChainConfig({ + assets: [ + new AssetConfig({ + asset: pen, + balance: BalanceBuilder().substrate().system().account(), + destination: moonbeam, + destinationFee: { + amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), + asset: pen, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetConfig({ + asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: moonbeam, + destinationFee: { + amount: 0.01, + asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + fee: { + asset: pen, + balance: BalanceBuilder().substrate().system().account(), + }, + }), + ], + chain: pendulum, +});