Skip to content

Commit

Permalink
Pendulum integration with Moonbeam (#176)
Browse files Browse the repository at this point in the history
* -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
  • Loading branch information
mmaurello authored Dec 29, 2023
1 parent 3c35743 commit c5dbedc
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/dirty-buckets-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@moonbeam-network/xcm-config': patch
'@moonbeam-network/xcm-sdk': patch
---

Pendulum integration with Moonbeam
6 changes: 6 additions & 0 deletions packages/config/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -346,6 +351,7 @@ export const assetsList: Asset[] = [
otp,
para,
paring,
pen,
pha,
pica,
ring,
Expand Down
29 changes: 29 additions & 0 deletions packages/config/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
otp,
para,
paring,
pen,
pha,
pica,
ring,
Expand Down Expand Up @@ -873,6 +874,10 @@ export const moonbeam = new EvmParachain({
asset: pha,
id: '132685552157663328694213725410064821485',
},
{
asset: pen,
id: '45647473099451451833602657905356404688',
},
{
asset: ring,
id: '125699734534028342599692732320197985871',
Expand Down Expand Up @@ -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: [
{
Expand Down Expand Up @@ -1447,6 +1475,7 @@ export const chainsList: AnyChain[] = [
originTrailAlphanet,
parallel,
parallelHeiko,
pendulum,
pendulumAlphanet,
phala,
picasso,
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -81,6 +82,7 @@ export const chainsConfigList: ChainConfig[] = [
originTrailAlphanetConfig,
parallelConfig,
parallelHeikoConfig,
pendulumConfig,
pendulumAlphanetConfig,
phalaConfig,
picassoConfig,
Expand Down
28 changes: 28 additions & 0 deletions packages/config/src/configs/moonbeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
nodl,
otp,
para,
pen,
pha,
ring,
sub,
Expand Down Expand Up @@ -45,6 +46,7 @@ import {
nodle,
originTrail,
parallel,
pendulum,
phala,
polkadot,
polkadotAssetHub,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
41 changes: 41 additions & 0 deletions packages/config/src/configs/pendulum.ts
Original file line number Diff line number Diff line change
@@ -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,
});

0 comments on commit c5dbedc

Please sign in to comment.