From 5a5072453e65d0012ce9826fb1b3b10062141dca Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:01:02 +0100 Subject: [PATCH] Zeitgeist - Moonbeam (#152) * zeitgeist integration with moonbeam * add changeset * changeset * remove redundant assetsData --- .changeset/stupid-islands-appear.md | 6 ++++++ packages/config/src/assets.ts | 6 ++++++ packages/config/src/chains.ts | 17 ++++++++++++++++ packages/config/src/configs/index.ts | 2 ++ packages/config/src/configs/moonbeam.ts | 17 ++++++++++++++++ packages/config/src/configs/zeitgeist.ts | 26 ++++++++++++++++++++++++ 6 files changed, 74 insertions(+) create mode 100644 .changeset/stupid-islands-appear.md create mode 100644 packages/config/src/configs/zeitgeist.ts diff --git a/.changeset/stupid-islands-appear.md b/.changeset/stupid-islands-appear.md new file mode 100644 index 00000000..02bbaf7f --- /dev/null +++ b/.changeset/stupid-islands-appear.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-config': patch +'@moonbeam-network/xcm-sdk': patch +--- + +Zeitgeist integration with Moonbeam diff --git a/packages/config/src/assets.ts b/packages/config/src/assets.ts index d7d41f3d..90a4f4e8 100644 --- a/packages/config/src/assets.ts +++ b/packages/config/src/assets.ts @@ -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, @@ -342,6 +347,7 @@ export const assetsList: Asset[] = [ wbtc, weth, wftm, + ztg, ]; export const assetsMap = new Map( diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index b60b4192..ed5a007b 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -61,6 +61,7 @@ import { wbtc, weth, xrt, + ztg, } from './assets'; export const acala = new Parachain({ @@ -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: @@ -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, @@ -1351,6 +1367,7 @@ export const chainsList: AnyChain[] = [ turing, turingAlphanet, uniqueAlpha, + zeitgeist, ]; export const chainsMap = new Map( diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index 699dfdd5..399f5eb1 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -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, @@ -88,6 +89,7 @@ export const chainsConfigList: ChainConfig[] = [ turingConfig, turingAlphanetConfig, uniqueAlphaConfig, + zeitgeistConfig, ]; export const chainsConfigMap = new Map( diff --git a/packages/config/src/configs/moonbeam.ts b/packages/config/src/configs/moonbeam.ts index b643b180..9ef5f85c 100644 --- a/packages/config/src/configs/moonbeam.ts +++ b/packages/config/src/configs/moonbeam.ts @@ -27,6 +27,7 @@ import { vglmr, wbtc, weth, + ztg, } from '../assets'; import { acala, @@ -44,6 +45,7 @@ import { phala, polkadot, polkadotAssetHub, + zeitgeist, } from '../chains'; import { AssetConfig } from '../types/AssetConfig'; import { ChainConfig } from '../types/ChainConfig'; @@ -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, }); diff --git a/packages/config/src/configs/zeitgeist.ts b/packages/config/src/configs/zeitgeist.ts new file mode 100644 index 00000000..3c543623 --- /dev/null +++ b/packages/config/src/configs/zeitgeist.ts @@ -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, +});