Skip to content

Commit

Permalink
feat: added support for PDEX transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ap211unitech committed Jun 4, 2024
1 parent aadd8d4 commit 9cd3670
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ export const toBeneficiary = (
};

export const toAsset = (asset: ChainAssetId) => {
return asset === "0" ? "Polkadex" : { Asset: asset };
return !asset || asset === "PDEX" ? "Polkadex" : { Asset: asset };
};
5 changes: 5 additions & 0 deletions packages/thea/src/config/substrate/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ export const moonbeam = new EvmParachain({
asset: glmr,
decimals: 18,
},
{
asset: pdex,
decimals: 12,
id: "90225766094594282577230355136633846906",
},
],
ecosystem: Ecosystem.Polkadot,
genesisHash: MOONBEAM_GENESIS,
Expand Down
19 changes: 18 additions & 1 deletion packages/thea/src/config/substrate/config/moonbeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BalanceBuilder } from "@moonbeam-network/xcm-builder";

import { ExtrinsicBuilderV2 } from "../builders";
import { moonbeam, polkadex } from "../chains";
import { glmr } from "../assets";
import { glmr, pdex } from "../assets";

const toPolkadex: AssetConfig[] = [
new AssetConfig({
Expand All @@ -21,6 +21,23 @@ const toPolkadex: AssetConfig[] = [
balance: BalanceBuilder().substrate().system().account(),
},
}),

// Not tested yet
new AssetConfig({
asset: pdex,
balance: BalanceBuilder().substrate().assets().account(),
destination: polkadex,
destinationFee: {
amount: 0,
asset: pdex,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilderV2().xTokens().evmTransfer(),
fee: {
asset: glmr,
balance: BalanceBuilder().substrate().system().account(),
},
}),
];

export const moonbeamConfig = new ChainConfig({
Expand Down
21 changes: 21 additions & 0 deletions packages/thea/src/config/substrate/config/polkadex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,27 @@ const toMoonbeam: AssetConfig[] = [
xcmDeliveryFeeAmount,
},
}),

new AssetConfig({
asset: pdex,
balance: BalanceBuilder().substrate().system().account(),
destination: moonbeam,
destinationFee: {
amount: 0.013,
asset: pdex,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilderV2()
.theaExecuter()
.parachainWithdraw()
.X2()
.sufficient(),
fee: {
asset: pdex,
balance: BalanceBuilder().substrate().system().account(),
xcmDeliveryFeeAmount,
},
}),
];

const toUnique: AssetConfig[] = [
Expand Down

0 comments on commit 9cd3670

Please sign in to comment.