Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 134c706

Browse files
committed
set core bridge messageFee to > 0 for integration tests. fixed placeFastMarketOrder & placeMarketOrder
1 parent d0228f0 commit 134c706

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

evm/env/testing.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export AVALANCHE_RPC=https://api.avax.network/ext/bc/C/rpc
2-
export ETHEREUM_RPC=https://rpc.ankr.com/eth
2+
export ETHEREUM_RPC=https://eth.llamarpc.com
33

44

55
export AVAX_USDC_ADDRESS=0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E

evm/ts/src/TokenRouter/evm.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class EvmTokenRouter implements TokenRouter<ethers.ContractTransaction> {
4242
redeemerMessage: Buffer | Uint8Array,
4343
minAmountOut?: bigint,
4444
refundAddress?: string,
45+
transactionValue?: bigint,
4546
) {
4647
if (minAmountOut !== undefined && refundAddress !== undefined) {
4748
return this.contract["placeMarketOrder(uint64,uint64,uint16,bytes32,bytes,address)"](
@@ -51,13 +52,19 @@ export class EvmTokenRouter implements TokenRouter<ethers.ContractTransaction> {
5152
redeemer,
5253
redeemerMessage,
5354
refundAddress,
55+
{
56+
value: transactionValue,
57+
}
5458
);
5559
} else {
5660
return this.contract["placeMarketOrder(uint64,uint16,bytes32,bytes)"](
5761
amountIn,
5862
targetChain,
5963
redeemer,
6064
redeemerMessage,
65+
{
66+
value: transactionValue,
67+
}
6168
);
6269
}
6370
}
@@ -71,6 +78,7 @@ export class EvmTokenRouter implements TokenRouter<ethers.ContractTransaction> {
7178
deadline: number,
7279
minAmountOut?: bigint,
7380
refundAddress?: string,
81+
transactionValue?: bigint,
7482
) {
7583
if (minAmountOut !== undefined && refundAddress !== undefined) {
7684
return this.contract[
@@ -84,6 +92,9 @@ export class EvmTokenRouter implements TokenRouter<ethers.ContractTransaction> {
8492
refundAddress,
8593
maxFee,
8694
deadline,
95+
{
96+
value: transactionValue,
97+
}
8798
);
8899
} else {
89100
return this.contract["placeFastMarketOrder(uint64,uint16,bytes32,bytes,uint64,uint32)"](
@@ -93,6 +104,9 @@ export class EvmTokenRouter implements TokenRouter<ethers.ContractTransaction> {
93104
redeemerMessage,
94105
maxFee,
95106
deadline,
107+
{
108+
value: transactionValue,
109+
}
96110
);
97111
}
98112
}

evm/ts/src/testing/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const USDC_DECIMALS: NetworkVars<number> = {
1919
Base: 6,
2020
};
2121

22-
export const WORMHOLE_MESSAGE_FEE = 0;
22+
export const WORMHOLE_MESSAGE_FEE = 100000000000000n;
2323
export const WORMHOLE_GUARDIAN_SET_INDEX = 4;
2424
export const GUARDIAN_PRIVATE_KEY =
2525
"cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0";

evm/ts/tests/00__environment.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ describe("Environment", () => {
5959
const actualChainId = await coreBridge.chainId();
6060
expect(actualChainId).to.equal(chainId);
6161

62+
{
63+
// set message fee
64+
const messageFeeSlot = 7;
65+
await provider.send("anvil_setStorageAt", [
66+
coreBridge.address,
67+
messageFeeSlot,
68+
ethers.utils.hexZeroPad(`0x${WORMHOLE_MESSAGE_FEE.toString(16)}`, 32),
69+
]);
70+
}
6271
// fetch current coreBridge protocol fee
6372
const messageFee = await coreBridge.messageFee();
6473
expect(messageFee.eq(WORMHOLE_MESSAGE_FEE)).to.be.true;
@@ -243,7 +252,7 @@ describe("Environment", () => {
243252
const scripts = `${__dirname}/../../sh`;
244253
const cmd =
245254
`bash ${scripts}/deploy_matching_engine.sh ` +
246-
`-n localnet -c ${chainName} -u ${localhost} -k ${owner.privateKey} ` +
255+
`-n localnet -c ${chainName} -u ${localhost} -k ${owner.privateKey}` +
247256
`> /dev/null 2>&1`;
248257
const out = execSync(cmd, { encoding: "utf8" });
249258

evm/ts/tests/03__marketOrder.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ChainType,
1515
parseLiquidityLayerEnvFile,
1616
tryNativeToUint8Array,
17+
WORMHOLE_MESSAGE_FEE,
1718
} from "../src/testing";
1819
import { toChainId } from "@wormhole-foundation/sdk-base";
1920

@@ -113,6 +114,7 @@ describe("Market Order Business Logic -- CCTP to CCTP", () => {
113114
Buffer.from("All your base are belong to us."),
114115
minAmountOut,
115116
fromWallet.address,
117+
WORMHOLE_MESSAGE_FEE,
116118
)
117119
.then((tx) => mineWait(fromProvider, tx))
118120
.catch((err) => {

0 commit comments

Comments
 (0)