From 30d689631e55d368f9bc3864f9b6a6ea418b001e Mon Sep 17 00:00:00 2001 From: Ryan Goulding Date: Thu, 2 Nov 2023 17:27:56 -0700 Subject: [PATCH] fix OmniCounter example A commit was added to add a payload to the default OmniCounter.sol. As such, we need to `estimateFees(...)` with the new payload. Poll the payload from the contract and use it in the task. Signed-off-by: Ryan Goulding --- tasks/incrementCounter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/incrementCounter.js b/tasks/incrementCounter.js index 1f00b27b..2d2407a4 100644 --- a/tasks/incrementCounter.js +++ b/tasks/incrementCounter.js @@ -6,10 +6,11 @@ module.exports = async function (taskArgs, hre) { const omniCounter = await ethers.getContract("OmniCounter") // quote fee with default adapterParams - let adapterParams = ethers.utils.solidityPack(["uint16", "uint256"], [1, 200000]) // default adapterParams example + const adapterParams = ethers.utils.solidityPack(["uint16", "uint256"], [1, 200000]) // default adapterParams example + const payload = await omniCounter.PAYLOAD() const endpoint = await ethers.getContractAt("ILayerZeroEndpoint", ENDPOINTS[hre.network.name]) - let fees = await endpoint.estimateFees(remoteChainId, omniCounter.address, "0x", false, adapterParams) + const fees = await endpoint.estimateFees(remoteChainId, omniCounter.address, payload, false, adapterParams) console.log(`fees[0] (wei): ${fees[0]} / (eth): ${ethers.utils.formatEther(fees[0])}`) let tx = await (await omniCounter.incrementCounter(remoteChainId, { value: fees[0] })).wait()