Skip to content

Instantly share code, notes, and snippets.

@Man-Jain
Last active March 24, 2025 03:33
Show Gist options
  • Save Man-Jain/de0f25777ddc6c81f10e07b5f12c5f4c to your computer and use it in GitHub Desktop.
Save Man-Jain/de0f25777ddc6c81f10e07b5f12c5f4c to your computer and use it in GitHub Desktop.
const rpcUrl = rpcUrls[originChainId];
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
// 0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47
const tokenRouterAddress = wormholeTokenRouterAddress[originChainId];
const tokenRouterContract = new ethers.Contract(
tokenRouterAddress,
tokenRouterAbi,
provider
);
const wh = await wormhole("Mainnet", [evm]);
// 8453
const originChain = wormholeChains[originChainId];
// 10
const destinationChain = wormholeChains[destinationChainId];
const sendChain = wh.getChain(originChain);
const rcvChain = wh.getChain(destinationChain);
const deadline = 0;
const minAmountOut = BigInt(0);
const FEE_AMOUNT = "100000";
// Depositor Address / Redeemer - 0x47C3E8E3607E01FF09FD98571c9cc2150aF4d6b9
// Refund Address - 0x47C3E8E3607E01FF09FD98571c9cc2150aF4d6b9
const fastMarketOrderCalldata = await tokenRouterContract.populateTransaction[
"placeFastMarketOrder(uint64,uint64,uint16,bytes32,bytes,address,uint64,uint32)"
](
amount,
minAmountOut,
rcvChain.config.chainId,
Buffer.from(tryNativeToUint8Array(depositorAddress, destinationChain)),
Buffer.from("Epoch Protocol"),
depositorAddress,
FEE_AMOUNT,
deadline
);
console.log("fastMarketOrderCalldata: ", fastMarketOrderCalldata);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment