Skip to content

Commit

Permalink
feat: add script for payload generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ethyla committed Dec 18, 2024
1 parent 10caf43 commit fd83a7a
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions scripts/deployers/rm-slashingManager/generatePayload.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {Script, stdJson, console} from "lib/forge-std/src/Script.sol";

// These imports get generated by npm run generate:interfaces
import {Governance} from "../../helpers/interfaces/Governance.generated.sol";
import {Registry} from "../../helpers/interfaces/Registry.generated.sol";

contract DeployFix is Script {
using stdJson for string;

Registry registry = Registry(0x33a02E6cC863D393d6Bf231B697b82F6e499cA71);

bytes32 private constant SLASHING_MANAGER = keccak256("slashingManager");

address governance = 0x6e7a5820baD6cebA8Ef5ea69c0C92EbbDAc9CE48;

address gSafeAddress = 0xCaf0aa768A3AE1297DF20072419Db8Bb8b5C8cEf;

function run() public {
console.log("Generating payload \n");
bytes memory payloadRegistry =
abi.encodeCall(Governance.update, (address(registry), abi.encodeCall(Registry.updateContractMap, (SLASHING_MANAGER, address(0x00)))));

console.log("Send: ");
console.logBytes(payloadRegistry);
console.log("to: ", governance);

uint256 mainnetFork;
mainnetFork = vm.createFork(vm.rpcUrl("mainnet"));
vm.selectFork(mainnetFork);
assert(registry.getSlashingManagerAddress() == 0x01F645DcD6C796F6BC6C982159B32fAaaebdC96A);
assert(registry.contractMap(SLASHING_MANAGER) == 0x01F645DcD6C796F6BC6C982159B32fAaaebdC96A);

vm.prank(gSafeAddress);
(bool success, /* bytes memory res */ ) = governance.call(payloadRegistry);
assert(success);
assert(registry.getSlashingManagerAddress() == address(0x00));
assert(registry.contractMap(SLASHING_MANAGER) == address(0x00));
}
}

0 comments on commit fd83a7a

Please sign in to comment.