difftreelog
fix Opal send relay tokens back
in: master
1 file changed
tests/src/xcm/xcmOpal.test.tsdiffbeforeafterboth31const ASSET_METADATA_DESCRIPTION = 'USDT';31const ASSET_METADATA_DESCRIPTION = 'USDT';32const ASSET_METADATA_MINIMAL_BALANCE = 1n;32const ASSET_METADATA_MINIMAL_BALANCE = 1n;333334const RELAY_DECIMALS = 12;34const WESTMINT_DECIMALS = 12;35const WESTMINT_DECIMALS = 12;353636const TRANSFER_AMOUNT = 1_000_000_000_000_000_000n;37const TRANSFER_AMOUNT = 1_000_000_000_000_000_000n;209210210 // common good parachain take commission in it native token211 // common good parachain take commission in it native token211 console.log(212 console.log(212 'Opal to Westmint transaction fees on Westmint: %s WND',213 '[Westmint -> Opal] transaction fees on Westmint: %s WND',213 helper.util.bigIntToDecimals(balanceStmnBefore - balanceStmnAfter, WESTMINT_DECIMALS),214 helper.util.bigIntToDecimals(balanceStmnBefore - balanceStmnAfter, WESTMINT_DECIMALS),214 );215 );215 expect(balanceStmnBefore > balanceStmnAfter).to.be.true;216 expect(balanceStmnBefore > balanceStmnAfter).to.be.true;226 balanceOpalAfter = await helper.balance.getSubstrate(alice.address);227 balanceOpalAfter = await helper.balance.getSubstrate(alice.address);227228228 console.log(229 console.log(229 'Opal to Westmint transaction fees on Opal: %s USDT',230 '[Westmint -> Opal] transaction fees on Opal: %s USDT',230 helper.util.bigIntToDecimals(TRANSFER_AMOUNT - free, ASSET_METADATA_DECIMALS),231 helper.util.bigIntToDecimals(TRANSFER_AMOUNT - free, ASSET_METADATA_DECIMALS),231 );232 );232 console.log(233 console.log(233 'Opal to Westmint transaction fees on Opal: %s OPL',234 '[Westmint -> Opal] transaction fees on Opal: %s OPL',234 helper.util.bigIntToDecimals(balanceOpalAfter - balanceOpalBefore),235 helper.util.bigIntToDecimals(balanceOpalAfter - balanceOpalBefore),235 );236 );236237360 });361 });361362362 itSub('Should connect and send Relay token back', async ({helper}) => {363 itSub('Should connect and send Relay token back', async ({helper}) => {364 let relayTokenBalanceBefore: bigint;365 let relayTokenBalanceAfter: bigint;366 await usingRelayPlaygrounds(relayUrl, async (helper) => {367 relayTokenBalanceBefore = await helper.balance.getSubstrate(bob.address);368 });369363 const destination = {370 const destination = {364 V1: {371 V1: {365 parents: 1,372 parents: 1,366 interior: {X2: [373 interior: {367 {368 Parachain: STATEMINE_CHAIN,369 },370 {374 X1:{371 AccountId32: {375 AccountId32: {372 network: 'Any',376 network: 'Any',373 id: bob.addressRaw,377 id: bob.addressRaw,374 },378 },375 },379 },376 ]},380 },377 },381 },378 };382 };379383391 await helper.xTokens.transferMulticurrencies(bob, currencies, feeItem, destination, {Unlimited: null});395 await helper.xTokens.transferMulticurrencies(bob, currencies, feeItem, destination, {Unlimited: null});392396393 balanceBobFinal = await helper.balance.getSubstrate(bob.address);397 balanceBobFinal = await helper.balance.getSubstrate(bob.address);394 console.log('Relay (Westend) to Opal transaction fees: %s OPL', balanceBobAfter - balanceBobFinal);398 console.log('[Opal -> Relay (Westend)] transaction fees: %s OPL', helper.util.bigIntToDecimals(balanceBobAfter - balanceBobFinal));399400 await usingRelayPlaygrounds(relayUrl, async (helper) => {401 await helper.wait.newBlocks(10);402 relayTokenBalanceAfter = await helper.balance.getSubstrate(bob.address);403404 const diff = relayTokenBalanceAfter - relayTokenBalanceBefore;405 console.log('[Opal -> Relay (Westend)] actually delivered: %s WND', helper.util.bigIntToDecimals(diff, RELAY_DECIMALS));406 expect(diff > 0, 'Relay tokens was not delivered back').to.be.true;407 });395 });408 });396});409});397410