Skip to content

Commit de87e3e

Browse files
authored
Change vDOT paying asset - fix decimals fetching in destination (#153)
* Change paying token for vDOT transfers and adapt decimals query in destination chain * add changeset
1 parent 159ce9a commit de87e3e

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@moonbeam-network/xcm-config': patch
3+
'@moonbeam-network/xcm-sdk': patch
4+
---
5+
6+
Change how we get decimals from assets in destination and change vDOT transfers paying asset

packages/config/src/chains.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export const bifrostPolkadot = new Parachain({
219219
name: 'Bifrost',
220220
parachainId: 2030,
221221
ss58Format: 6,
222-
ws: 'wss://hk.p.bifrost-rpc.liebi.com/ws',
222+
ws: 'wss://eu.bifrost-polkadot-rpc.liebi.com/ws',
223223
});
224224

225225
export const calamari = new Parachain({

packages/config/src/configs/bifrostPolkadot.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ export const bifrostPolkadotConfig = new ChainConfig({
5959
balance: BalanceBuilder().substrate().tokens().accounts(),
6060
destination: moonbeam,
6161
destinationFee: {
62-
amount: 0.2,
63-
asset: bnc,
64-
balance: BalanceBuilder().substrate().system().account(),
62+
amount: 0.01,
63+
asset: vdot,
64+
balance: BalanceBuilder().substrate().tokens().accounts(),
6565
},
66-
extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(),
66+
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
6767
fee: {
6868
asset: bnc,
6969
balance: BalanceBuilder().substrate().system().account(),

packages/sdk/src/getTransferData/getDestinationData.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ export async function getDestinationData({
4646
const balanceAmount = zeroAmount.copyWith({ amount: balance });
4747
const { existentialDeposit } = polkadot;
4848

49-
const feeAmount = await getFee({ config: transferConfig, polkadot });
49+
const feeAmount = await getFee({
50+
address: destinationAddress,
51+
config: transferConfig,
52+
evmSigner,
53+
polkadot,
54+
});
5055
const minAmount = zeroAmount.copyWith({ amount: min });
5156

5257
return {
@@ -59,16 +64,26 @@ export async function getDestinationData({
5964
}
6065

6166
export interface GetFeeParams {
67+
address: string;
6268
config: TransferConfig;
69+
evmSigner?: EvmSigner;
6370
polkadot: PolkadotService;
6471
}
6572

6673
export async function getFee({
74+
address,
6775
config,
76+
evmSigner,
6877
polkadot,
6978
}: GetFeeParams): Promise<AssetAmount> {
7079
const { amount, asset } = config.source.config.destinationFee;
71-
const decimals = await polkadot.getAssetDecimals(asset);
80+
const decimals = await getDecimals({
81+
address,
82+
asset,
83+
config: config.destination.config,
84+
evmSigner,
85+
polkadot,
86+
});
7287
const zeroAmount = AssetAmount.fromAsset(asset, {
7388
amount: 0n,
7489
decimals,

0 commit comments

Comments
 (0)