Skip to content

Commit

Permalink
fix: prod deploy gas opt (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: 0xRaccoon <[email protected]>
  • Loading branch information
0xRaccoon authored Dec 11, 2024
1 parent 477806e commit 1f85708
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ contract WinddownUpgrade is Script {
bytes32 storageData = vm.load(address(optimismPortalProxy), OWNER_KEY);
address adminAddress = address(uint160(uint256(storageData)));

console.log("OptimismPortal admin address: ", adminAddress);

vm.startBroadcast(adminAddress);

// Deploy OptimismPortal implementation
Expand Down Expand Up @@ -86,6 +88,8 @@ contract WinddownUpgrade is Script {

vm.startBroadcast(adminAddress);

console.log("L1StandardBridge admin address: ", adminAddress);

// Deploy L1StandardBridge implementation
L1StandardBridge l1StandardBridgeImpl = new L1StandardBridge({
_messenger: payable(WinddownConstants.MESSENGER),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ contract WinddownImplementationDeploy is Script {
uint256 _deployerPk = vm.envUint("PRIVATE_KEY_DEPLOYER");
address _deployer = vm.addr(_deployerPk);
address _balanceClaimerProxyAdmin = vm.envAddress("BALANCE_CLAIMER_PROXY_ADMIN_PUBLIC_ADDRESS");

vm.startBroadcast(_deployer);

// Deploy BalanceClaimer proxy
Expand All @@ -38,11 +37,6 @@ contract WinddownImplementationDeploy is Script {
// Change the admin of the BalanceClaimer proxy
balanceClaimerProxy.changeAdmin(_balanceClaimerProxyAdmin);

// BalanceClaimer assertions
assert(address(BalanceClaimer(address(balanceClaimerProxy)).ETH_BALANCE_WITHDRAWER()) == WinddownConstants.OPTIMISM_PORTAL_PROXY);
assert(address(BalanceClaimer(address(balanceClaimerProxy)).ERC20_BALANCE_WITHDRAWER()) == WinddownConstants.L1_STANDARD_BRIDGE_PROXY);
assert(BalanceClaimer(address(balanceClaimerProxy)).ROOT() == WinddownConstants.MERKLE_ROOT);

// Deploy OptimismPortal implementation
OptimismPortal opPortalImpl = new OptimismPortal({
_l2Oracle: L2OutputOracle(WinddownConstants.L2_ORACLE),
Expand All @@ -52,19 +46,27 @@ contract WinddownImplementationDeploy is Script {
_balanceClaimer: address(balanceClaimerProxy)
});

// OptimismPortal assertions
assert(address(OptimismPortal(payable(address(opPortalImpl))).L2_ORACLE()) == WinddownConstants.L2_ORACLE);
assert(address(OptimismPortal(payable(address(opPortalImpl))).GUARDIAN()) == WinddownConstants.GUARDIAN);
assert(address(OptimismPortal(payable(address(opPortalImpl))).SYSTEM_CONFIG()) == WinddownConstants.SYSTEM_CONFIG);
assert(address(OptimismPortal(payable(address(opPortalImpl))).BALANCE_CLAIMER()) == address(balanceClaimerProxy));
// No assertion for pause since it's set in the initializer and setting true or false in the new implementation constructor parameter is idempotent

// Deploy L1StandardBridge implementation
L1StandardBridge l1StandardBridgeImpl = new L1StandardBridge({
_messenger: payable(WinddownConstants.MESSENGER),
_balanceClaimer: address(balanceClaimerProxy)
});

vm.stopBroadcast();

// BalanceClaimer assertions
assert(address(BalanceClaimer(address(balanceClaimerProxy)).ETH_BALANCE_WITHDRAWER()) == WinddownConstants.OPTIMISM_PORTAL_PROXY);
assert(address(BalanceClaimer(address(balanceClaimerProxy)).ERC20_BALANCE_WITHDRAWER()) == WinddownConstants.L1_STANDARD_BRIDGE_PROXY);
assert(BalanceClaimer(address(balanceClaimerProxy)).ROOT() == WinddownConstants.MERKLE_ROOT);

// OptimismPortal assertions
assert(address(OptimismPortal(payable(address(opPortalImpl))).L2_ORACLE()) == WinddownConstants.L2_ORACLE);
assert(address(OptimismPortal(payable(address(opPortalImpl))).GUARDIAN()) == WinddownConstants.GUARDIAN);
assert(address(OptimismPortal(payable(address(opPortalImpl))).SYSTEM_CONFIG()) == WinddownConstants.SYSTEM_CONFIG);
assert(address(OptimismPortal(payable(address(opPortalImpl))).BALANCE_CLAIMER()) == address(balanceClaimerProxy));
// No assertion for pause since it's set in the initializer and setting true or false in the new implementation constructor parameter is idempotent

// L1StandardBridge assertions
assert(address(L1StandardBridge(payable(address(l1StandardBridgeImpl))).BALANCE_CLAIMER()) == address(balanceClaimerProxy));
assert(address(L1StandardBridge(payable(address(l1StandardBridgeImpl))).MESSENGER()) == WinddownConstants.MESSENGER);
Expand All @@ -73,7 +75,5 @@ contract WinddownImplementationDeploy is Script {
console.log("BalanceClaimer implementatoin deployed at: ", address(balanceClaimerImpl));
console.log("OptimismPortal implementation deployed at: ", address(opPortalImpl));
console.log("L1StandardBridge implementation deployed at: ", address(l1StandardBridgeImpl));

vm.stopBroadcast();
}
}

0 comments on commit 1f85708

Please sign in to comment.