Skip to content

Commit

Permalink
DED integration with Moonbeam (#232)
Browse files Browse the repository at this point in the history
* initial DED config

* add changeset

* adjust fees
  • Loading branch information
mmaurello authored Apr 15, 2024
1 parent ee5cd03 commit ddd6079
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rude-news-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@moonbeam-network/xcm-config': patch
---

DED integration between Polkadot AssetHub and Moonbeam
6 changes: 6 additions & 0 deletions packages/config/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export const dai = new Asset({
originSymbol: 'DAI',
});

export const ded = new Asset({
key: 'ded',
originSymbol: 'DED',
});

export const fil = new Asset({
key: 'fil',
originSymbol: 'FIL',
Expand Down Expand Up @@ -348,6 +353,7 @@ export const assetsList: Asset[] = [
crab,
csm,
dai,
ded,
dev,
dot,
eq,
Expand Down
10 changes: 10 additions & 0 deletions packages/config/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
crab,
csm,
dai,
ded,
dev,
dot,
eq,
Expand Down Expand Up @@ -792,6 +793,10 @@ export const moonbeam = new EvmParachain({
id: '0x06e605775296e851FF43b4dAa541Bb0984E9D6fD',
metadataId: 0, // no metadata for ERC20 tokens
},
{
asset: ded,
id: '124463719055550872076363892993240202694',
},
{
asset: dot,
id: '42259045809535163221576417993425387648',
Expand Down Expand Up @@ -1286,6 +1291,11 @@ export const polkadotAssetHub = new Parachain({
id: 1984,
palletInstance: 50,
},
{
asset: ded,
id: 30,
palletInstance: 50,
},
{
asset: dot,
// NOTE: no meta for native token
Expand Down
16 changes: 16 additions & 0 deletions packages/config/src/configs/moonbeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
bnc,
cfg,
dai,
ded,
dot,
eq,
eqd,
Expand Down Expand Up @@ -499,6 +500,21 @@ export const moonbeamConfig = new ChainConfig({
balance: BalanceBuilder().substrate().system().account(),
},
}),
new AssetConfig({
asset: ded,
balance: BalanceBuilder().substrate().assets().account(),
contract: ContractBuilder().Xtokens().transferMultiCurrencies(),
destination: polkadotAssetHub,
destinationFee: {
amount: 0.2,
asset: usdt,
balance: BalanceBuilder().substrate().assets().account(),
},
fee: {
asset: glmr,
balance: BalanceBuilder().substrate().system().account(),
},
}),
new AssetConfig({
asset: hdx,
balance: BalanceBuilder().substrate().assets().account(),
Expand Down
22 changes: 21 additions & 1 deletion packages/config/src/configs/polkadotAssetHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ExtrinsicBuilder,
FeeBuilder,
} from '@moonbeam-network/xcm-builder';
import { dot, pink, usdc, usdt } from '../assets';
import { ded, dot, pink, usdc, usdt } from '../assets';
import { moonbeam, polkadotAssetHub } from '../chains';
import { AssetConfig } from '../types/AssetConfig';
import { ChainConfig } from '../types/ChainConfig';
Expand Down Expand Up @@ -73,6 +73,26 @@ export const polkadotAssetHubConfig = new ChainConfig({
},
min: AssetMinBuilder().assets().asset(),
}),
new AssetConfig({
asset: ded,
balance: BalanceBuilder().substrate().assets().account(),
destination: moonbeam,
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(),
}),
],
chain: polkadotAssetHub,
});

0 comments on commit ddd6079

Please sign in to comment.