From 3d9da541b4909b4093981c09fb565dc30c0e1fe9 Mon Sep 17 00:00:00 2001 From: green-jay Date: Tue, 27 Feb 2024 13:36:41 +0100 Subject: [PATCH] Adjust CRU fees and comment out AH assets --- packages/xcm-cfg/src/assets.ts | 6 + packages/xcm-cfg/src/chains.ts | 24 ++++ packages/xcm-cfg/src/configs/astar.ts | 31 ++-- packages/xcm-cfg/src/configs/bifrost.ts | 31 ++-- packages/xcm-cfg/src/configs/crust.ts | 26 ++++ packages/xcm-cfg/src/configs/hydraDX.ts | 175 +++++++++++++---------- packages/xcm-cfg/src/configs/index.ts | 2 + packages/xcm-cfg/src/configs/interlay.ts | 31 ++-- packages/xcm-cfg/src/configs/moonbeam.ts | 61 ++++---- 9 files changed, 237 insertions(+), 150 deletions(-) create mode 100644 packages/xcm-cfg/src/configs/crust.ts diff --git a/packages/xcm-cfg/src/assets.ts b/packages/xcm-cfg/src/assets.ts index cb3430fa..c5c8ef19 100644 --- a/packages/xcm-cfg/src/assets.ts +++ b/packages/xcm-cfg/src/assets.ts @@ -94,10 +94,16 @@ export const unq = new Asset({ originSymbol: 'UNQ', }); +export const cru = new Asset({ + key: 'cru', + originSymbol: 'CRU', +}); + export const assets: Asset[] = [ aca, astr, cfg, + cru, bnc, dai_awh, dai_mwh, diff --git a/packages/xcm-cfg/src/chains.ts b/packages/xcm-cfg/src/chains.ts index c34d81f8..69ec9cd9 100644 --- a/packages/xcm-cfg/src/chains.ts +++ b/packages/xcm-cfg/src/chains.ts @@ -32,6 +32,7 @@ import { weth_mwh, ztg, pha, + cru, } from './assets'; export const acala = new Parachain({ @@ -308,6 +309,11 @@ export const hydraDX = new Parachain({ id: 8, decimals: 12, }, + { + asset: cru, + id: 27, + decimals: 12, + }, ], ecosystem: Ecosystem.Polkadot, genesisHash: @@ -526,12 +532,30 @@ export const unique = new Parachain({ ws: 'wss://unique-rpc.dwellir.com', }); +export const crust = new Parachain({ + assetsData: [ + { + asset: cru, + id: 0, + }, + ], + ecosystem: Ecosystem.Polkadot, + genesisHash: + '0x4319cc49ee79495b57a1fec4d2bd43f59052dcc690276de566c2691d6df4f7b8', + key: 'crust', + name: 'Crust network', + parachainId: 2008, + ss58Format: 88, + ws: 'wss://crust-parachain.crustapps.net', +}); + export const chains: AnyChain[] = [ acala, assetHub, astar, bifrost, centrifuge, + crust, hydraDX, interlay, moonbeam, diff --git a/packages/xcm-cfg/src/configs/astar.ts b/packages/xcm-cfg/src/configs/astar.ts index d033420b..1fd26a27 100644 --- a/packages/xcm-cfg/src/configs/astar.ts +++ b/packages/xcm-cfg/src/configs/astar.ts @@ -35,21 +35,22 @@ const toHydraDX: AssetConfig[] = [ }, extrinsic: ExtrinsicBuilderV2().xTokens().transfer() }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().assets().account(), - destination: hydraDX, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().assets().account(), - }, - fee: { - asset: astr, - balance: BalanceBuilder().substrate().system().account(), - }, - extrinsic: ExtrinsicBuilderV2().xTokens().transfer() - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().assets().account(), + // destination: hydraDX, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().assets().account(), + // }, + // fee: { + // asset: astr, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // extrinsic: ExtrinsicBuilderV2().xTokens().transfer() + // }), ]; export const astarConfig = new ChainConfig({ diff --git a/packages/xcm-cfg/src/configs/bifrost.ts b/packages/xcm-cfg/src/configs/bifrost.ts index a6616207..5dec249d 100644 --- a/packages/xcm-cfg/src/configs/bifrost.ts +++ b/packages/xcm-cfg/src/configs/bifrost.ts @@ -47,21 +47,22 @@ const toHydraDX: AssetConfig[] = [ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - destination: hydraDX, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - extrinsic: ExtrinsicBuilderV2().xTokens().transfer(), - fee: { - asset: bnc, - balance: BalanceBuilder().substrate().system().account(), - } - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // destination: hydraDX, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // extrinsic: ExtrinsicBuilderV2().xTokens().transfer(), + // fee: { + // asset: bnc, + // balance: BalanceBuilder().substrate().system().account(), + // } + // }), ]; const toPolkadot: AssetConfig[] = [ diff --git a/packages/xcm-cfg/src/configs/crust.ts b/packages/xcm-cfg/src/configs/crust.ts new file mode 100644 index 00000000..e71dce6b --- /dev/null +++ b/packages/xcm-cfg/src/configs/crust.ts @@ -0,0 +1,26 @@ +import { + BalanceBuilder, + ExtrinsicBuilder, +} from '@moonbeam-network/xcm-builder'; +import { AssetConfig, ChainConfig } from '@moonbeam-network/xcm-config'; +import { cru } from '../assets'; +import { hydraDX, crust } from '../chains'; + +const toHydraDX: AssetConfig[] = [ + new AssetConfig({ + asset: cru, + balance: BalanceBuilder().substrate().system().account(), + destination: hydraDX, + destinationFee: { + amount: 0.01, + asset: cru, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), +]; + +export const crustConfig = new ChainConfig({ + assets: [...toHydraDX], + chain: crust, +}); diff --git a/packages/xcm-cfg/src/configs/hydraDX.ts b/packages/xcm-cfg/src/configs/hydraDX.ts index 9c785a37..1260b5b8 100644 --- a/packages/xcm-cfg/src/configs/hydraDX.ts +++ b/packages/xcm-cfg/src/configs/hydraDX.ts @@ -13,6 +13,7 @@ import { astr, bnc, cfg, + cru, dai_awh, dai_mwh, dot, @@ -41,6 +42,7 @@ import { astar, bifrost, centrifuge, + crust, hydraDX, interlay, moonbeam, @@ -164,21 +166,22 @@ const toAstar: AssetConfig[] = [ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - destination: astar, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), - fee: { - asset: hdx, - balance: BalanceBuilder().substrate().system().account(), - }, - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // destination: astar, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), + // fee: { + // asset: hdx, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // }), ]; const toBifrost: AssetConfig[] = [ @@ -227,21 +230,22 @@ const toBifrost: AssetConfig[] = [ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - destination: bifrost, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), - fee: { - asset: hdx, - balance: BalanceBuilder().substrate().system().account(), - }, - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // destination: bifrost, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), + // fee: { + // asset: hdx, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // }), ]; const toCentrifuge: AssetConfig[] = [ @@ -308,21 +312,22 @@ const toInterlay: AssetConfig[] = [ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - destination: interlay, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), - fee: { - asset: hdx, - balance: BalanceBuilder().substrate().system().account(), - }, - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // destination: interlay, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), + // fee: { + // asset: hdx, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // }), ]; const toMoonbeam: AssetConfig[] = [ @@ -443,36 +448,37 @@ const toMoonbeam: AssetConfig[] = [ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - destination: moonbeam, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), - fee: { - asset: hdx, - balance: BalanceBuilder().substrate().system().account(), - }, - }), - new AssetConfig({ - asset: usdc, - balance: BalanceBuilder().substrate().tokens().accounts(), - destination: moonbeam, - destinationFee: { - amount: 1.4, - asset: usdc, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), - fee: { - asset: hdx, - balance: BalanceBuilder().substrate().system().account(), - }, - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // destination: moonbeam, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), + // fee: { + // asset: hdx, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // }), + // new AssetConfig({ + // asset: usdc, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // destination: moonbeam, + // destinationFee: { + // amount: 1.4, + // asset: usdc, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // extrinsic: ExtrinsicBuilderV2().xTokens().transferMultiasset(1000).X3(), + // fee: { + // asset: hdx, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // }), ]; const toPolkadot: AssetConfig[] = [ @@ -613,6 +619,24 @@ const toUnique: AssetConfig[] = [ }), ]; +const toCrust: AssetConfig[] = [ + new AssetConfig({ + asset: cru, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: crust, + destinationFee: { + amount: 0.04, + asset: cru, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + fee: { + asset: hdx, + balance: BalanceBuilder().substrate().system().account(), + }, + }), +]; + export const hydraDxConfig = new ChainConfig({ assets: [ ...toAcala, @@ -620,6 +644,7 @@ export const hydraDxConfig = new ChainConfig({ ...toAstar, ...toBifrost, ...toCentrifuge, + ...toCrust, ...toInterlay, ...toMoonbeam, ...toNodle, diff --git a/packages/xcm-cfg/src/configs/index.ts b/packages/xcm-cfg/src/configs/index.ts index bcc87b1a..4f282cc0 100644 --- a/packages/xcm-cfg/src/configs/index.ts +++ b/packages/xcm-cfg/src/configs/index.ts @@ -14,6 +14,7 @@ import { subsocialConfig } from './subsocial'; import { uniqueConfig } from './unique'; import { zeitgeistConfig } from './zeitgeist'; import { phalaConfig } from './phala'; +import { crustConfig } from './crust'; export const chainsConfig: ChainConfig[] = [ acalaConfig, @@ -30,6 +31,7 @@ export const chainsConfig: ChainConfig[] = [ uniqueConfig, zeitgeistConfig, phalaConfig, + crustConfig, ]; export const chainsConfigMap = new Map( diff --git a/packages/xcm-cfg/src/configs/interlay.ts b/packages/xcm-cfg/src/configs/interlay.ts index 442ae6c1..ac7488fd 100644 --- a/packages/xcm-cfg/src/configs/interlay.ts +++ b/packages/xcm-cfg/src/configs/interlay.ts @@ -49,21 +49,22 @@ const toHydraDX: AssetConfig[] = [ balance: BalanceBuilder().substrate().tokens().accounts(), }, }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - destination: hydraDX, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - extrinsic: ExtrinsicBuilder().xTokens().transfer(), - fee: { - asset: intr, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // destination: hydraDX, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // extrinsic: ExtrinsicBuilder().xTokens().transfer(), + // fee: { + // asset: intr, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // }), ]; export const interlayConfig = new ChainConfig({ diff --git a/packages/xcm-cfg/src/configs/moonbeam.ts b/packages/xcm-cfg/src/configs/moonbeam.ts index 3c70258e..6131d16a 100644 --- a/packages/xcm-cfg/src/configs/moonbeam.ts +++ b/packages/xcm-cfg/src/configs/moonbeam.ts @@ -132,36 +132,37 @@ const toHydraDX: AssetConfig[] = [ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: usdt, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: hydraDX, - destinationFee: { - amount: 1.4, - asset: usdt, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - fee: { - asset: glmr, - balance: BalanceBuilder().substrate().system().account(), - }, - }), - new AssetConfig({ - asset: usdc, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: hydraDX, - destinationFee: { - amount: 1.4, - asset: usdc, - balance: BalanceBuilder().substrate().tokens().accounts(), - }, - fee: { - asset: glmr, - balance: BalanceBuilder().substrate().system().account(), - }, - }), + // TODO: Uncomment with asset hub release 1.7 (jit_withdraw fix) + // new AssetConfig({ + // asset: usdt, + // balance: BalanceBuilder().substrate().assets().account(), + // contract: ContractBuilder().Xtokens().transfer(), + // destination: hydraDX, + // destinationFee: { + // amount: 1.4, + // asset: usdt, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // fee: { + // asset: glmr, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // }), + // new AssetConfig({ + // asset: usdc, + // balance: BalanceBuilder().substrate().assets().account(), + // contract: ContractBuilder().Xtokens().transfer(), + // destination: hydraDX, + // destinationFee: { + // amount: 1.4, + // asset: usdc, + // balance: BalanceBuilder().substrate().tokens().accounts(), + // }, + // fee: { + // asset: glmr, + // balance: BalanceBuilder().substrate().system().account(), + // }, + // }), ]; export const moonbeamConfig = new ChainConfig({