Skip to content

Commit

Permalink
Zeitgeist - Moonbeam (#152)
Browse files Browse the repository at this point in the history
* zeitgeist integration with moonbeam

* add changeset

* changeset

* remove redundant assetsData
  • Loading branch information
mmaurello authored Nov 6, 2023
1 parent 345680e commit 5a50724
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/stupid-islands-appear.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
---

Zeitgeist 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 @@ -285,6 +285,11 @@ export const xrt = new Asset({
originSymbol: 'XRT',
});

export const ztg = new Asset({
key: 'ztg',
originSymbol: 'ZTG',
});

export const assetsList: Asset[] = [
aca,
alan,
Expand Down Expand Up @@ -342,6 +347,7 @@ export const assetsList: Asset[] = [
wbtc,
weth,
wftm,
ztg,
];

export const assetsMap = new Map<string, Asset>(
Expand Down
17 changes: 17 additions & 0 deletions packages/config/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import {
wbtc,
weth,
xrt,
ztg,
} from './assets';

export const acala = new Parachain({
Expand Down Expand Up @@ -898,6 +899,10 @@ export const moonbeam = new EvmParachain({
id: '0xab3f0245B83feB11d15AAffeFD7AD465a59817eD',
metadataId: 0, // no metadata for ERC20 tokens
},
{
asset: ztg,
id: '150874409661081770150564009349448205842',
},
],
ecosystem: Ecosystem.Polkadot,
genesisHash:
Expand Down Expand Up @@ -1307,6 +1312,17 @@ export const uniqueAlpha = new Parachain({
ws: 'wss://unique-alpha.unique.network',
});

export const zeitgeist = new Parachain({
ecosystem: Ecosystem.Polkadot,
genesisHash:
'0x1bf2a2ecb4a868de66ea8610f2ce7c8c43706561b6476031315f6640fe38e060',
key: 'zeitgeist',
name: 'Zeitgeist',
parachainId: 2092,
ss58Format: 73,
ws: 'wss://zeitgeist-rpc.dwellir.com',
});

export const chainsList: AnyChain[] = [
acala,
alphanetRelay,
Expand Down Expand Up @@ -1351,6 +1367,7 @@ export const chainsList: AnyChain[] = [
turing,
turingAlphanet,
uniqueAlpha,
zeitgeist,
];

export const chainsMap = new Map<string, AnyChain>(
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 @@ -43,6 +43,7 @@ import { shidenConfig } from './shiden';
import { turingConfig } from './turing';
import { turingAlphanetConfig } from './turingAlphanet';
import { uniqueAlphaConfig } from './uniqueAlpha';
import { zeitgeistConfig } from './zeitgeist';

export const chainsConfigList: ChainConfig[] = [
acalaConfig,
Expand Down Expand Up @@ -88,6 +89,7 @@ export const chainsConfigList: ChainConfig[] = [
turingConfig,
turingAlphanetConfig,
uniqueAlphaConfig,
zeitgeistConfig,
];

export const chainsConfigMap = new Map<string, ChainConfig>(
Expand Down
17 changes: 17 additions & 0 deletions packages/config/src/configs/moonbeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
vglmr,
wbtc,
weth,
ztg,
} from '../assets';
import {
acala,
Expand All @@ -44,6 +45,7 @@ import {
phala,
polkadot,
polkadotAssetHub,
zeitgeist,
} from '../chains';
import { AssetConfig } from '../types/AssetConfig';
import { ChainConfig } from '../types/ChainConfig';
Expand Down Expand Up @@ -528,6 +530,21 @@ export const moonbeamConfig = new ChainConfig({
balance: BalanceBuilder().substrate().system().account(),
},
}),
new AssetConfig({
asset: ztg,
balance: BalanceBuilder().substrate().assets().account(),
contract: ContractBuilder().Xtokens().transfer(),
destination: zeitgeist,
destinationFee: {
amount: 0.01,
asset: ztg,
balance: BalanceBuilder().substrate().assets().account(),
},
fee: {
asset: glmr,
balance: BalanceBuilder().substrate().system().account(),
},
}),
],
chain: moonbeam,
});
26 changes: 26 additions & 0 deletions packages/config/src/configs/zeitgeist.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {
BalanceBuilder,
ExtrinsicBuilder,
FeeBuilder,
} from '@moonbeam-network/xcm-builder';
import { ztg } from '../assets';
import { moonbeam, zeitgeist } from '../chains';
import { AssetConfig } from '../types/AssetConfig';
import { ChainConfig } from '../types/ChainConfig';

export const zeitgeistConfig = new ChainConfig({
assets: [
new AssetConfig({
asset: ztg,
balance: BalanceBuilder().substrate().system().account(),
destination: moonbeam,
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: ztg,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
}),
],
chain: zeitgeist,
});

0 comments on commit 5a50724

Please sign in to comment.