From a6f48df94bd662c120676c8d72a697ef59181220 Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:43:58 +0100 Subject: [PATCH] USDT Wormhole integration (#155) * USDT wormhole integration and remove Subsocial Alphanet * change usdc variable name * add changeset --- .changeset/slimy-lies-exercise.md | 6 ++++ packages/config/src/assets.ts | 10 +++++-- packages/config/src/chains.ts | 29 +++++++++---------- packages/config/src/configs/hydraDX.ts | 19 ++++++++++-- packages/config/src/configs/index.ts | 2 -- packages/config/src/configs/moonbaseAlpha.ts | 17 ----------- packages/config/src/configs/moonbeam.ts | 22 ++++++++++++-- .../config/src/configs/subsocialAlphanet.ts | 29 ------------------- 8 files changed, 63 insertions(+), 71 deletions(-) create mode 100644 .changeset/slimy-lies-exercise.md delete mode 100644 packages/config/src/configs/subsocialAlphanet.ts diff --git a/.changeset/slimy-lies-exercise.md b/.changeset/slimy-lies-exercise.md new file mode 100644 index 00000000..db9cb136 --- /dev/null +++ b/.changeset/slimy-lies-exercise.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-config': patch +'@moonbeam-network/xcm-sdk': patch +--- + +USDT Wormhole integration diff --git a/packages/config/src/assets.ts b/packages/config/src/assets.ts index be9d0812..d7d41f3d 100644 --- a/packages/config/src/assets.ts +++ b/packages/config/src/assets.ts @@ -220,7 +220,7 @@ export const unit = new Asset({ originSymbol: 'Unit', }); -export const usdc = new Asset({ +export const usdcwh = new Asset({ key: 'usdcwh', originSymbol: 'USDC.Wh', }); @@ -230,6 +230,11 @@ export const usdt = new Asset({ originSymbol: 'USDT', }); +export const usdtwh = new Asset({ + key: 'usdtwh', + originSymbol: 'USDT.Wh', +}); + export const wbtc = new Asset({ key: 'wbtc', originSymbol: 'WBTC', @@ -324,8 +329,9 @@ export const assetsList: Asset[] = [ tt1, tur, unit, - usdc, + usdcwh, usdt, + usdtwh, vbnc, vdot, vfil, diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 6c719bc5..9384ed9a 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -49,8 +49,9 @@ import { tt1, tur, unit, - usdc, + usdcwh, usdt, + usdtwh, vbnc, vdot, vfil, @@ -433,9 +434,13 @@ export const hydraDX = new Parachain({ id: 18, }, { - asset: usdc, + asset: usdcwh, id: 21, }, + { + asset: usdtwh, + id: 23, + }, { asset: wbtc, id: 19, @@ -855,10 +860,15 @@ export const moonbeam = new EvmParachain({ id: '125699734534028342599692732320197985871', }, { - asset: usdc, + asset: usdcwh, id: '0x931715FEE2d06333043d11F658C8CE934aC61D0c', metadataId: 0, // no metadata for ERC20 tokens }, + { + asset: usdtwh, + id: '0xc30E9cA94CF52f3Bf5692aaCF81353a27052c46f', + metadataId: 0, + }, { asset: usdt, id: '311091173110107856861649819128533077277', @@ -1279,18 +1289,6 @@ export const turingAlphanet = new Parachain({ ws: 'wss://turing-moonbase.rpc.oak.tech/', }); -export const subsocialAlphanet = new Parachain({ - ecosystem: Ecosystem.AlphanetRelay, - genesisHash: - '0x01f15f9d48ea279640cb35267bfd33a88bb4c21ebb00b129e9bc2d2236aaafdb', - isTestChain: true, - key: 'subsocial-alphanet', - name: 'Subsocial Alphanet', - parachainId: 2100, - ss58Format: 42, - ws: 'wss://alphasoon.f3joule.space', -}); - export const uniqueAlpha = new Parachain({ assetsData: [ { @@ -1350,7 +1348,6 @@ export const chainsList: AnyChain[] = [ kusamaAssetHub, alphanetAssetHub, polkadotAssetHub, - subsocialAlphanet, turing, turingAlphanet, uniqueAlpha, diff --git a/packages/config/src/configs/hydraDX.ts b/packages/config/src/configs/hydraDX.ts index de5583f6..aa74f427 100644 --- a/packages/config/src/configs/hydraDX.ts +++ b/packages/config/src/configs/hydraDX.ts @@ -3,7 +3,7 @@ import { ExtrinsicBuilder, FeeBuilder, } from '@moonbeam-network/xcm-builder'; -import { dai, glmr, hdx, usdc, wbtc, weth } from '../assets'; +import { dai, glmr, hdx, usdcwh, usdtwh, wbtc, weth } from '../assets'; import { hydraDX, moonbeam } from '../chains'; import { AssetConfig } from '../types/AssetConfig'; import { ChainConfig } from '../types/ChainConfig'; @@ -48,7 +48,22 @@ export const hydraDxConfig = new ChainConfig({ }, }), new AssetConfig({ - asset: usdc, + asset: usdcwh, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: moonbeam, + destinationFee: { + amount: 0.04, + asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), + fee: { + asset: hdx, + balance: BalanceBuilder().substrate().system().account(), + }, + }), + new AssetConfig({ + asset: usdtwh, balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index 90853821..699dfdd5 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -40,7 +40,6 @@ import { polkadotConfig } from './polkadot'; import { polkadotAssetHubConfig } from './polkadotAssetHub'; import { robonomicsConfig } from './robonomics'; import { shidenConfig } from './shiden'; -import { subsocialAlphanetConfig } from './subsocialAlphanet'; import { turingConfig } from './turing'; import { turingAlphanetConfig } from './turingAlphanet'; import { uniqueAlphaConfig } from './uniqueAlpha'; @@ -86,7 +85,6 @@ export const chainsConfigList: ChainConfig[] = [ alphanetAssetHubConfig, kusamaAssetHubConfig, polkadotAssetHubConfig, - subsocialAlphanetConfig, turingConfig, turingAlphanetConfig, uniqueAlphaConfig, diff --git a/packages/config/src/configs/moonbaseAlpha.ts b/packages/config/src/configs/moonbaseAlpha.ts index 4483648e..ee4d7478 100644 --- a/packages/config/src/configs/moonbaseAlpha.ts +++ b/packages/config/src/configs/moonbaseAlpha.ts @@ -9,7 +9,6 @@ import { otp, paring, pica, - soon, tt1, tur, unit, @@ -24,7 +23,6 @@ import { moonbaseBeta, originTrailAlphanet, picassoAlphanet, - subsocialAlphanet, turingAlphanet, } from '../chains'; import { AssetConfig } from '../types/AssetConfig'; @@ -211,21 +209,6 @@ export const moonbaseAlphaConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: soon, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: subsocialAlphanet, - destinationFee: { - amount: 0.4, - asset: soon, - balance: BalanceBuilder().substrate().assets().account(), - }, - fee: { - asset: dev, - balance: BalanceBuilder().substrate().system().account(), - }, - }), new AssetConfig({ asset: tt1, balance: BalanceBuilder().substrate().assets().account(), diff --git a/packages/config/src/configs/moonbeam.ts b/packages/config/src/configs/moonbeam.ts index 58b0649d..b643b180 100644 --- a/packages/config/src/configs/moonbeam.ts +++ b/packages/config/src/configs/moonbeam.ts @@ -19,8 +19,9 @@ import { para, pha, ring, - usdc, + usdcwh, usdt, + usdtwh, vdot, vfil, vglmr, @@ -408,13 +409,28 @@ export const moonbeamConfig = new ChainConfig({ }, }), new AssetConfig({ - asset: usdc, + asset: usdcwh, balance: BalanceBuilder().evm().erc20(), contract: ContractBuilder().Xtokens().transfer(), destination: hydraDX, destinationFee: { amount: 0.004, - asset: usdc, + asset: usdcwh, + balance: BalanceBuilder().evm().erc20(), + }, + fee: { + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), + new AssetConfig({ + asset: usdtwh, + balance: BalanceBuilder().evm().erc20(), + contract: ContractBuilder().Xtokens().transfer(), + destination: hydraDX, + destinationFee: { + amount: 0.004, + asset: usdtwh, balance: BalanceBuilder().evm().erc20(), }, fee: { diff --git a/packages/config/src/configs/subsocialAlphanet.ts b/packages/config/src/configs/subsocialAlphanet.ts deleted file mode 100644 index 84de6e89..00000000 --- a/packages/config/src/configs/subsocialAlphanet.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - BalanceBuilder, - ExtrinsicBuilder, - FeeBuilder, -} from '@moonbeam-network/xcm-builder'; -import { soon } from '../assets'; -import { moonbaseAlpha, subsocialAlphanet } from '../chains'; -import { AssetConfig } from '../types/AssetConfig'; -import { ChainConfig } from '../types/ChainConfig'; - -export const subsocialAlphanetConfig = new ChainConfig({ - assets: [ - new AssetConfig({ - asset: soon, - balance: BalanceBuilder().substrate().system().account(), - destination: moonbaseAlpha, - destinationFee: { - amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), - asset: soon, - balance: BalanceBuilder().substrate().system().account(), - }, - extrinsic: ExtrinsicBuilder() - .polkadotXcm() - .limitedReserveTransferAssets() - .here(), - }), - ], - chain: subsocialAlphanet, -});