Skip to content

Commit

Permalink
Merge branch 'shah/deploy-tooling-updates' into shah/deploy-13
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Jun 7, 2024
2 parents 449a981 + 810e129 commit 038a67e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
23 changes: 17 additions & 6 deletions contracts/utils/GovFive.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,27 @@ 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));

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));
}
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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();
}

Expand Down
6 changes: 5 additions & 1 deletion tests/staking/MigratorForkTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions tests/staking/ZapperForkTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 038a67e

Please sign in to comment.