Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add state diff proposal example #9

Merged
merged 5 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions script/DeployGovernorBravo.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ contract DeployGovernorBravo is MultisigProposal {
Timelock timelock = new Timelock(deployer, 1);

// Add PROTOCOL_TIMELOCK_BRAVO address
addresses.addAddress(
"PROTOCOL_TIMELOCK_BRAVO",
address(timelock),
true
);
addresses.addAddress("PROTOCOL_TIMELOCK_BRAVO", address(timelock), true);
}

if (!addresses.isAddressSet("PROTOCOL_GOVERNANCE_TOKEN")) {
Expand All @@ -41,11 +37,7 @@ contract DeployGovernorBravo is MultisigProposal {
govToken.mint(deployer, 1e21);

// Add PROTOCOL_GOVERNANCE_TOKEN address
addresses.addAddress(
"PROTOCOL_GOVERNANCE_TOKEN",
address(govToken),
true
);
addresses.addAddress("PROTOCOL_GOVERNANCE_TOKEN", address(govToken), true);
}

if (!addresses.isAddressSet("PROTOCOL_GOVERNOR")) {
Expand All @@ -71,10 +63,7 @@ contract DeployGovernorBravo is MultisigProposal {
addresses.getAddress("PROTOCOL_TIMELOCK_BRAVO"),
0,
"",
abi.encodeWithSignature(
"setPendingAdmin(address)",
addresses.getAddress("PROTOCOL_GOVERNOR")
),
abi.encodeWithSignature("setPendingAdmin(address)", addresses.getAddress("PROTOCOL_GOVERNOR")),
block.timestamp + 180
);

Expand All @@ -93,4 +82,4 @@ contract DeployGovernorBravo is MultisigProposal {
// ensure governance token is minted to deployer address
assertEq(govToken.balanceOf(addresses.getAddress("DEPLOYER_EOA")), 1e21);
}
}
}
4 changes: 3 additions & 1 deletion script/DeployOZGovernor.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ contract DeployOZGovernor is MultisigProposal {
}

// add propose and execute role for governor
TimelockController(payable(addresses.getAddress("OZ_GOVERNOR_TIMELOCK"))).grantRole(keccak256("PROPOSER_ROLE"), addresses.getAddress("OZ_GOVERNOR"));
TimelockController(payable(addresses.getAddress("OZ_GOVERNOR_TIMELOCK"))).grantRole(
keccak256("PROPOSER_ROLE"), addresses.getAddress("OZ_GOVERNOR")
);

addresses.printJSONChanges();
}
Expand Down
17 changes: 4 additions & 13 deletions script/DeployTimelock.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,12 @@ contract DeployTimelock is MultisigProposal {
executors[0] = dev;

// Deploy a new TimelockController
TimelockController timelockController = new TimelockController(
60,
proposers,
executors,
address(0)
);
TimelockController timelockController = new TimelockController(60, proposers, executors, address(0));

// Add PROTOCOL_TIMELOCK address
addresses.addAddress(
"PROTOCOL_TIMELOCK",
address(timelockController),
true
);
addresses.addAddress("PROTOCOL_TIMELOCK", address(timelockController), true);
}

addresses.printJSONChanges();
}

Expand All @@ -62,4 +53,4 @@ contract DeployTimelock is MultisigProposal {
// ensure deployer has executor role
assertTrue(timelockController.hasRole(timelockController.EXECUTOR_ROLE(), dev));
}
}
}
13 changes: 2 additions & 11 deletions script/InitializeBravo.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ contract InitializeBravo is MultisigProposal {
function deploy() public override {
address governor = addresses.getAddress("PROTOCOL_GOVERNOR");

address payable timelock = payable(
addresses.getAddress("PROTOCOL_TIMELOCK_BRAVO")
);
address payable timelock = payable(addresses.getAddress("PROTOCOL_TIMELOCK_BRAVO"));

if (!addresses.isAddressSet("PROTOCOL_GOVERNOR_ALPHA")) {
// Deploy mock GovernorAlpha
Expand All @@ -33,14 +31,7 @@ contract InitializeBravo is MultisigProposal {
}

Timelock(timelock).executeTransaction(
timelock,
0,
"",
abi.encodeWithSignature(
"setPendingAdmin(address)",
address(governor)
),
vm.envUint("ETA")
timelock, 0, "", abi.encodeWithSignature("setPendingAdmin(address)", address(governor)), vm.envUint("ETA")
);

// Initialize GovernorBravo
Expand Down
7 changes: 2 additions & 5 deletions src/mocks/arbitrum/MockArbSys.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ pragma solidity ^0.8.0;
contract MockArbSys {
uint256 public ticketId;

function sendTxToL1(
address _l1Target,
bytes memory _data
) external payable returns (uint256) {
(bool success, ) = _l1Target.call(_data);
function sendTxToL1(address _l1Target, bytes memory _data) external payable returns (uint256) {
(bool success,) = _l1Target.call(_data);
require(success, "Arbsys: sendTxToL1 failed");
return ++ticketId;
}
Expand Down
6 changes: 1 addition & 5 deletions src/mocks/arbitrum/MockProxyUpgradeAction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import {IProxyAdmin} from "@forge-proposal-simulator/src/interface/IProxyAdmin.s
/// @title ProxyUpgradeAction
/// @dev Arbitrum upgrades must be done through a delegate call to a GAC deployed contract
contract MockProxyUpgradeAction {
function perform(
address admin,
address payable target,
address newLogic
) public payable {
function perform(address admin, address payable target, address newLogic) public payable {
IProxyAdmin(admin).upgrade(target, newLogic);
}
}
Loading
Loading