From 9df6359a17b077a1ce18deb751ca7e83738f461c Mon Sep 17 00:00:00 2001 From: pan Date: Tue, 16 Apr 2024 04:57:20 +0800 Subject: [PATCH] BNCS integration with Moonbeam (#229) * BNCS integration with Moonbeam * BNCS integration with Moonbeam * Update packages/config/src/configs/moonbeam.ts Co-authored-by: mmaurello <93129175+mmaurello@users.noreply.github.com> * Update packages/config/src/configs/moonbeam.ts Co-authored-by: mmaurello <93129175+mmaurello@users.noreply.github.com> * Update packages/config/src/configs/bifrostPolkadot.ts Co-authored-by: mmaurello <93129175+mmaurello@users.noreply.github.com> * Update packages/config/src/configs/moonbeam.ts Co-authored-by: mmaurello <93129175+mmaurello@users.noreply.github.com> --------- Co-authored-by: mmaurello <93129175+mmaurello@users.noreply.github.com> --- .changeset/blue-ducks-vanish.md | 5 +++++ packages/config/src/assets.ts | 6 ++++++ packages/config/src/chains.ts | 9 +++++++++ packages/config/src/configs/bifrostPolkadot.ts | 18 +++++++++++++++++- packages/config/src/configs/moonbeam.ts | 16 ++++++++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .changeset/blue-ducks-vanish.md diff --git a/.changeset/blue-ducks-vanish.md b/.changeset/blue-ducks-vanish.md new file mode 100644 index 00000000..f673ce70 --- /dev/null +++ b/.changeset/blue-ducks-vanish.md @@ -0,0 +1,5 @@ +--- +'@moonbeam-network/xcm-config': patch +--- + +BNCS integration with Moonbeam diff --git a/packages/config/src/assets.ts b/packages/config/src/assets.ts index 904e47cb..78d3f493 100644 --- a/packages/config/src/assets.ts +++ b/packages/config/src/assets.ts @@ -45,6 +45,11 @@ export const bnc = new Asset({ originSymbol: 'BNC', }); +export const bncs = new Asset({ + key: 'bncs', + originSymbol: 'BNCS', +}); + export const cfg = new Asset({ key: 'cfg', originSymbol: 'CFG', @@ -349,6 +354,7 @@ export const assetsList: Asset[] = [ auq, aseed, bnc, + bncs, cfg, crab, csm, diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 23b7a720..3103d2d8 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -14,6 +14,7 @@ import { auq, betaDEV, bnc, + bncs, cfg, crab, csm, @@ -210,6 +211,10 @@ export const bifrostPolkadot = new Parachain({ asset: bnc, id: { Native: bnc.originSymbol }, }, + { + asset: bncs, + id: { Token2: 9 }, + }, { asset: fil, id: { Token2: 4 }, @@ -784,6 +789,10 @@ export const moonbeam = new EvmParachain({ asset: bnc, id: '165823357460190568952172802245839421906', }, + { + asset: bncs, + id: '142155548796783636521833385094843759961', + }, { asset: cfg, id: '91372035960551235635465443179559840483', diff --git a/packages/config/src/configs/bifrostPolkadot.ts b/packages/config/src/configs/bifrostPolkadot.ts index f76fdb1c..d7f4ab8e 100644 --- a/packages/config/src/configs/bifrostPolkadot.ts +++ b/packages/config/src/configs/bifrostPolkadot.ts @@ -4,7 +4,7 @@ import { ExtrinsicBuilder, FeeBuilder, } from '@moonbeam-network/xcm-builder'; -import { bnc, fil, glmr, vastr, vdot, vfil, vglmr, vmanta } from '../assets'; +import { bnc, bncs, fil, glmr, vastr, vdot, vfil, vglmr, vmanta } from '../assets'; import { bifrostPolkadot, moonbeam } from '../chains'; import { AssetConfig } from '../types/AssetConfig'; import { ChainConfig } from '../types/ChainConfig'; @@ -134,6 +134,22 @@ export const bifrostPolkadotConfig = new ChainConfig({ }, min: AssetMinBuilder().assetRegistry().currencyMetadatas(), }), + new AssetConfig({ + asset: bncs, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: moonbeam, + destinationFee: { + amount: 0.05, + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), + fee: { + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + min: AssetMinBuilder().assetRegistry().currencyMetadatas(), + }), ], chain: bifrostPolkadot, }); diff --git a/packages/config/src/configs/moonbeam.ts b/packages/config/src/configs/moonbeam.ts index 43c2f71d..bcfebaff 100644 --- a/packages/config/src/configs/moonbeam.ts +++ b/packages/config/src/configs/moonbeam.ts @@ -4,6 +4,7 @@ import { aseed, astr, bnc, + bncs, cfg, dai, ded, @@ -740,6 +741,21 @@ export const moonbeamConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: bncs, + balance: BalanceBuilder().substrate().assets().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: bifrostPolkadot, + destinationFee: { + amount: 0.0001, + asset: bncs, + balance: BalanceBuilder().substrate().assets().account(), + }, + fee: { + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), ], chain: moonbeam, });