diff --git a/contracts/utils/GovFive.sol b/contracts/utils/GovFive.sol index 50fa84a9..37cf86f4 100644 --- a/contracts/utils/GovFive.sol +++ b/contracts/utils/GovFive.sol @@ -49,8 +49,7 @@ library GovFive { GovFiveAction memory propAction = prop.actions[i]; targets[i] = propAction.receiver; - payloads[i] = - abi.encodePacked(abi.encodePacked(bytes4(keccak256(bytes(propAction.fullsig)))), propAction.data); + payloads[i] = abi.encodePacked(bytes4(keccak256(bytes(propAction.fullsig))), propAction.data); } bytes32 salt = keccak256(bytes(prop.description)); @@ -58,17 +57,19 @@ library GovFive { TimelockController timelock = TimelockController(payable(Addresses.TIMELOCK)); receiver = Addresses.TIMELOCK; - opHash = timelock.hashOperationBatch(targets, values, payloads, hex"", salt); + opHash = timelock.hashOperationBatch(targets, values, payloads, bytes32(0), salt); if (timelock.isOperation(opHash)) { bytes4 executeSig = bytes4(keccak256(bytes("executeBatch(address[],uint256[],bytes[],bytes32,bytes32)"))); - payload = abi.encodePacked(executeSig, abi.encode(targets, values, payloads, hex"", salt)); + console.log("Yet to be exeucted."); + payload = abi.encodePacked(executeSig, abi.encode(targets, values, payloads, bytes32(0), salt)); } else { bytes4 scheduleSig = - bytes4(keccak256(bytes("scheduleBatch(address[],uint256[],bytes[],bytes32,bytes32,delay)"))); + bytes4(keccak256(bytes("scheduleBatch(address[],uint256[],bytes[],bytes32,bytes32,uint256)"))); - payload = abi.encodePacked(scheduleSig, abi.encode(targets, values, payloads, hex"", salt, 2 days)); + console.log("Yet to be scheduled."); + payload = abi.encodePacked(scheduleSig, abi.encode(targets, values, payloads, bytes32(0), salt, 2 days)); } } @@ -112,6 +113,10 @@ library GovFive { console.log("Scheduling..."); (bool success, bytes memory data) = receiver.call(payload); + if (!success || !timelock.isOperationDone(opHash)) { + revert("Failed to schedule"); + } + (receiver, payload, opHash) = getSafeTxData(prop); } @@ -124,6 +129,12 @@ library GovFive { (bool success, bytes memory data) = receiver.call(payload); + if (!success || !timelock.isOperationDone(opHash)) { + revert("Failed to execute"); + } + + console.log("Executed"); + vm.stopPrank(); } diff --git a/tests/staking/MigratorForkTest.t.sol b/tests/staking/MigratorForkTest.t.sol index 62fc160a..217ad230 100644 --- a/tests/staking/MigratorForkTest.t.sol +++ b/tests/staking/MigratorForkTest.t.sol @@ -23,7 +23,7 @@ contract MigratorForkTest is Test { IMintableERC20 public ogn; uint256 constant OGN_EPOCH = 1717041600; // May 30, 2024 GMT - address public ogvWhale = 0x24dD9AEAf497c11eE3A0ac2E6E6e014e12799c4E; + address public ogvWhale = 0xD066c92d5dD4fD19E7F053Cf63EBB01Aaaa233CE; constructor() { deployManager = new DeployManager(); @@ -46,6 +46,10 @@ contract MigratorForkTest is Test { ogv.approve(address(veogv), type(uint256).max); vm.stopPrank(); + vm.startPrank(Addresses.TIMELOCK); + ogn.mint(ogvWhale, 10_000_000 ether); // Mint some OGV for the whale + vm.stopPrank(); + vm.warp(OGN_EPOCH + 100 days); if (veogv.balanceOf(ogvWhale) == 0) { diff --git a/tests/staking/ZapperForkTest.t.sol b/tests/staking/ZapperForkTest.t.sol index 34942ad6..263b984d 100644 --- a/tests/staking/ZapperForkTest.t.sol +++ b/tests/staking/ZapperForkTest.t.sol @@ -51,6 +51,10 @@ contract ZapperForkTest is Test { ogv.approve(address(veogv), type(uint256).max); vm.stopPrank(); + vm.startPrank(Addresses.TIMELOCK); + ogn.mint(ogvWhale, 10_000_000 ether); // Mint some OGV for the whale + vm.stopPrank(); + vm.warp(OGN_EPOCH + 100 days); if (veogv.balanceOf(ogvWhale) == 0) {