From e716796988fd8c4116e7fd00b83c9b79bb7a4a27 Mon Sep 17 00:00:00 2001 From: green-jay Date: Thu, 28 Mar 2024 11:50:52 +0100 Subject: [PATCH] usdt & usdc & pink [AH<>Bifrost] --- packages/xcm-cfg/src/chains.ts | 20 ++++++- packages/xcm-cfg/src/configs/assethub.ts | 67 +++++++++++++++++++++++- packages/xcm-cfg/src/configs/bifrost.ts | 55 +++++++++++++++++-- 3 files changed, 136 insertions(+), 6 deletions(-) diff --git a/packages/xcm-cfg/src/chains.ts b/packages/xcm-cfg/src/chains.ts index e54dd33b..2bec0c16 100644 --- a/packages/xcm-cfg/src/chains.ts +++ b/packages/xcm-cfg/src/chains.ts @@ -170,9 +170,27 @@ export const bifrost = new Parachain({ }, { asset: usdt, - id: { Token2: 2 }, + balanceId: { Token2: 2 }, + id: 1984, metadataId: { Token2: 2 }, decimals: 6, + palletInstance: 50, + }, + { + asset: usdc, + id: 1337, + balanceId: { Token2: 5 }, + metadataId: { Token2: 5 }, + decimals: 6, + palletInstance: 50, + }, + { + asset: pink, + balanceId: { Token2: 10 }, + id: 23, + metadataId: 23, + decimals: 10, + palletInstance: 50, }, ], ecosystem: Ecosystem.Polkadot, diff --git a/packages/xcm-cfg/src/configs/assethub.ts b/packages/xcm-cfg/src/configs/assethub.ts index 62e768d9..4f502e00 100644 --- a/packages/xcm-cfg/src/configs/assethub.ts +++ b/packages/xcm-cfg/src/configs/assethub.ts @@ -11,7 +11,7 @@ import { } from '@moonbeam-network/xcm-config'; import { ded, dot, pink, usdc, usdt } from '../assets'; -import { assetHub, hydraDX, moonbeam } from '../chains'; +import { assetHub, bifrost, hydraDX, moonbeam } from '../chains'; import { ExtrinsicBuilderV2 } from '../builders'; const xcmDeliveryFeeAmount = 0.036; @@ -185,7 +185,70 @@ const toMoonbeam: AssetConfig[] = [ }), ]; +const toBifrost: AssetConfig[] = [ + new AssetConfig({ + asset: pink, + balance: BalanceBuilder().substrate().assets().account(), + destination: bifrost, + destinationFee: { + amount: 0.0001, + asset: pink, + balance: BalanceBuilder().substrate().assets().account(), + }, + extrinsic: ExtrinsicBuilderV2() + .polkadotXcm() + .limitedReserveTransferAssets() + .X2(), + fee: { + asset: dot, + balance: BalanceBuilder().substrate().system().account(), + xcmDeliveryFeeAmount, + }, + min: AssetMinBuilder().assets().asset(), + }), + new AssetConfig({ + asset: usdt, + balance: BalanceBuilder().substrate().assets().account(), + destination: bifrost, + destinationFee: { + amount: 0.03, + asset: usdt, + balance: BalanceBuilder().substrate().assets().account(), + }, + extrinsic: ExtrinsicBuilder() + .polkadotXcm() + .limitedReserveTransferAssets() + .X2(), + fee: { + asset: dot, + balance: BalanceBuilder().substrate().system().account(), + xcmDeliveryFeeAmount, + }, + min: AssetMinBuilder().assets().asset(), + }), + new AssetConfig({ + asset: usdc, + balance: BalanceBuilder().substrate().assets().account(), + destination: bifrost, + destinationFee: { + amount: 0.03, + asset: usdc, + balance: BalanceBuilder().substrate().assets().account(), + }, + extrinsic: ExtrinsicBuilder() + .polkadotXcm() + .limitedReserveTransferAssets() + .X2(), + fee: { + asset: dot, + balance: BalanceBuilder().substrate().system().account(), + xcmDeliveryFeeAmount, + }, + min: AssetMinBuilder().assets().asset(), + }), +]; + export const assetHubConfig = new ChainConfig({ - assets: [...toHydraDX, ...toPolkadot, ...toMoonbeam], + assets: [...toHydraDX, ...toPolkadot, ...toMoonbeam, ...toBifrost], chain: assetHub, }); diff --git a/packages/xcm-cfg/src/configs/bifrost.ts b/packages/xcm-cfg/src/configs/bifrost.ts index 15e8f545..f7b46d06 100644 --- a/packages/xcm-cfg/src/configs/bifrost.ts +++ b/packages/xcm-cfg/src/configs/bifrost.ts @@ -1,8 +1,8 @@ import { BalanceBuilder } from '@moonbeam-network/xcm-builder'; -import { AssetConfig, ChainConfig, polkadot } from '@moonbeam-network/xcm-config'; +import { AssetConfig, ChainConfig, polkadot, usdc } from '@moonbeam-network/xcm-config'; -import { bnc, vdot, dot, usdt, hdx } from '../assets'; -import { bifrost, hydraDX } from '../chains'; +import { bnc, vdot, dot, usdt, hdx, pink } from '../assets'; +import { assetHub, bifrost, hydraDX } from '../chains'; import { ExtrinsicBuilderV2 } from '../builders'; const toHydraDX: AssetConfig[] = [ @@ -83,10 +83,59 @@ const toPolkadot: AssetConfig[] = [ }), ]; +const toAssetHub: AssetConfig[] = [ + new AssetConfig({ + asset: pink, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: assetHub, + destinationFee: { + amount: 0.18, + asset: usdt, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiassets().X3(), + fee: { + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + }), + new AssetConfig({ + asset: usdt, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: assetHub, + destinationFee: { + amount: 0.11, + asset: usdt, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiassets().X3(), + fee: { + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + }), + new AssetConfig({ + asset: usdc, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: assetHub, + destinationFee: { + amount: 0.11, + asset: usdc, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiassets().X3(), + fee: { + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + }), +]; + export const bifrostConfig = new ChainConfig({ assets: [ ...toHydraDX, ...toPolkadot, + ...toAssetHub, ], chain: bifrost, });