Skip to content

Commit

Permalink
fix testi ng acala evm
Browse files Browse the repository at this point in the history
  • Loading branch information
nohaapav committed Nov 29, 2024
1 parent 002619f commit 72b13e0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/xcm-transfer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ const xTransfer = await wallet.transfer(
const status = await xTransfer.validate();

// Construct calldata with transfer amount
const fee: AssetAmount = await xTransfer.estimateFee('0.0001');
const fee: AssetAmount = await xTransfer.estimateFee('0.1');
const feeInfo = [
'Estimated fee:',
fee.toDecimal(fee.decimals),
fee.originSymbol,
].join(' ');
const call: XCall = await xTransfer.buildCall('0.0001');
const call: XCall = await xTransfer.buildCall('0.1');

// Dump transfer info
console.log(xTransfer);
Expand Down
6 changes: 3 additions & 3 deletions packages/xcm-cfg/src/configs/polkadot/acala-evm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AssetRoute, ChainRoutes } from '@galacticcouncil/xcm-core';

import { aca, dai_awh } from '../../assets';
import { aca, dai_awh, dai_mwh } from '../../assets';
import { hydration, moonbeam, acala_evm } from '../../chains';
import { BalanceBuilder, ContractBuilder } from '../../builders';

Expand All @@ -20,10 +20,10 @@ const toHydrationViaWormhole: AssetRoute[] = [
},
destination: {
chain: hydration,
asset: dai_awh,
asset: dai_mwh,
fee: {
amount: 0,
asset: dai_awh,
asset: dai_mwh,
},
},
contract: ContractBuilder()
Expand Down
52 changes: 52 additions & 0 deletions packages/xcm-cfg/src/configs/polkadot/hydration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
} from '../../../assets';
import {
acala,
acala_evm,
ajuna,
assetHub,
astar,
Expand All @@ -67,6 +68,7 @@ import {
zeitgeist,
} from '../../../chains';
import {
ContractBuilder,
ExtrinsicBuilder,
ExtrinsicBuilderV4,
XcmTransferType,
Expand All @@ -79,6 +81,8 @@ import {
toEthereumViaWormholeTemplate,
toMoonbeamErc20Template,
toZeitgeistErc20Template,
MRL_EXECUTION_FEE,
MRL_XCM_FEE,
} from './templates';

const toAcala: AssetRoute[] = [
Expand Down Expand Up @@ -817,6 +821,53 @@ const toAjuna: AssetRoute[] = [
}),
];

const toAcalaViaWormhole: AssetRoute[] = [
new AssetRoute({
source: {
asset: dai_mwh,
balance: balance(),
fee: fee(),
destinationFee: {
balance: balance(),
},
},
destination: {
chain: acala_evm,
asset: dai_awh,
fee: {
amount: 0.06,
asset: aca,
},
},
extrinsic: ExtrinsicBuilder()
.utility()
.batchAll([
ExtrinsicBuilder().xTokens().transferMultiCurrencies(),
ExtrinsicBuilder().polkadotXcm().send().transact({
fee: MRL_EXECUTION_FEE,
}),
]),
transact: {
chain: moonbeam,
fee: {
amount: MRL_XCM_FEE,
asset: glmr,
balance: balance(),
},
extrinsic: ExtrinsicBuilder()
.ethereumXcm()
.transact(
ContractBuilder()
.Batch()
.batchAll([
ContractBuilder().Erc20().approve(),
ContractBuilder().Wormhole().TokenBridge().transferTokens(),
])
),
},
}),
];

const toEthereumViaWormhole: AssetRoute[] = [
toEthereumViaWormholeTemplate(dai_mwh, dai),
toEthereumViaWormholeTemplate(weth_mwh, eth),
Expand All @@ -834,6 +885,7 @@ export const hydrationConfig = new ChainRoutes({
chain: hydration,
routes: [
...toAcala,
...toAcalaViaWormhole,
...toAjuna,
...toAssetHub,
...toAstar,
Expand Down

0 comments on commit 72b13e0

Please sign in to comment.