revertRedeemLocal.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. module.exports = async function (taskArgs, hre) {
  2. let owner = (await ethers.getSigners())[0]
  3. const router = await ethers.getContract("Router")
  4. let eventFilter = router.filters.Revert()
  5. let events = await router.queryFilter(eventFilter)
  6. let ctr = 0
  7. for (let e of events) {
  8. console.log(e.args)
  9. let chainId = e.args.chainId
  10. let srcAddress = e.args.srcAddress
  11. let nonce = e.args.nonce
  12. // try to get teh retryLookup - if its all 0s its already been cleared!
  13. let revertLookup = await router.revertLookup(chainId, srcAddress, nonce)
  14. console.log(`revertLookup[${chainId}][${srcAddress}][nonce:${nonce}]: ${revertLookup}`)
  15. if (revertLookup === "0x") {
  16. console.log(`the revertLookup was ${revertLookup}, indicating its already been withdrawn!`)
  17. continue
  18. }
  19. let tx = await (
  20. await router.revertRedeemLocal(
  21. chainId,
  22. srcAddress,
  23. nonce,
  24. owner.address,
  25. { dstGasForCall: 0, dstNativeAmount: 0, dstNativeAddr: "0x" },
  26. { value: ethers.utils.parseEther("3") } // send native value for the underlying message cost
  27. )
  28. ).wait()
  29. console.log(chainId, srcAddress, nonce, `tx: ${tx.transactionHash}`)
  30. ctr++
  31. }
  32. console.log(`found ${ctr} things to to the B portion of the A-B-A withdraw (0 means there were none)`)
  33. }