Skip to content

Commit e8b8803

Browse files
committed
enable passing of lastid to lz-set-config task
1 parent 2163bb8 commit e8b8803

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tasks/lz-set-config.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const { abi: EndpoingV2ABI } = require("@layerzerolabs/lz-evm-protocol-v2/artifa
66

77
// run as "npx hardhat --network arbitrumSepolia lz-set-config --dest baseSepolia"
88
task("lz-set-config", "Set config for LZ network to dest network")
9-
.addOptionalParam("dest", "destination network")
9+
.addOptionalParam("dest", "Destination network")
10+
.addOptionalParam("lastid", "Custom last Id in case last transaction was cancelled")
1011
.setAction(async (taskArgs, hre) => {
1112
if (hre.network.name === "hardhat") {
1213
console.warn(
@@ -171,10 +172,14 @@ task("lz-set-config", "Set config for LZ network to dest network")
171172
const latestBlock = await hre.ethers.provider.getBlockNumber();
172173
console.log("latestBlock:", latestBlock)
173174

174-
// Fetch events
175-
const events = await timelockControllerContract.queryFilter(timelockControllerContract.filters[eventName](), 0, latestBlock);
175+
let lastId = taskArgs.lastid
176+
177+
if(!lastId) {
178+
// Fetch events
179+
const events = await timelockControllerContract.queryFilter(timelockControllerContract.filters[eventName](), 0, latestBlock);
180+
lastId = events.length > 0 ? events[events.length - 1].args.id : hre.ethers.constants.HashZero;
181+
}
176182

177-
const lastId = events.length > 0 ? events[events.length - 1].args.id : hre.ethers.constants.HashZero;
178183
console.log("lastId:", lastId)
179184

180185
console.log("==================scheduleBatch parameters==================")

0 commit comments

Comments
 (0)