|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +pragma solidity 0.8.15; |
| 3 | + |
| 4 | +import "@base-contracts/script/universal/MultisigBuilder.sol"; |
| 5 | +import "@eth-optimism-bedrock/contracts/L1/OptimismPortal.sol"; |
| 6 | + |
| 7 | +contract RollbackUnpausePortal is MultisigBuilder { |
| 8 | + address constant internal OPTIMISM_PORTAL_PROXY = vm.envAddress("OPTIMISM_PORTAL_PROXY"); // TODO: define OPTIMISM_PORTAL_PROXY=xxx in the .env file |
| 9 | + address constant internal GUARDIAN = vm.envAddress("GUARDIAN"); // TODO: define GUARDIAN=xxx in the .env file |
| 10 | + |
| 11 | + function _postCheck() internal override view { |
| 12 | + OptimismPortal optimismPortal = OptimismPortal(payable(OPTIMISM_PORTAL_PROXY)); |
| 13 | + require(optimismPortal.paused() == false, "UnpausePortal: Portal did not get unpaused"); |
| 14 | + } |
| 15 | + |
| 16 | + function _buildCalls() internal override view returns (IMulticall3.Call3[] memory) { |
| 17 | + IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1); |
| 18 | + |
| 19 | + calls[0] = IMulticall3.Call3({ |
| 20 | + target: OPTIMISM_PORTAL_PROXY, |
| 21 | + allowFailure: false, |
| 22 | + callData: abi.encodeCall( |
| 23 | + OptimismPortal.unpause, () |
| 24 | + ) |
| 25 | + }); |
| 26 | + |
| 27 | + return calls; |
| 28 | + } |
| 29 | + |
| 30 | + function _ownerSafe() internal override view returns (address) { |
| 31 | + return GUARDIAN; |
| 32 | + } |
| 33 | + |
| 34 | + function _addOverrides(address _safe) internal override view returns (SimulationStateOverride memory) { |
| 35 | + IGnosisSafe safe = IGnosisSafe(payable(_safe)); |
| 36 | + uint256 _nonce = _getNonce(safe); |
| 37 | + return overrideSafeThresholdOwnerAndNonce(_safe, DEFAULT_SENDER, _nonce); |
| 38 | + } |
| 39 | + |
| 40 | + // This transaction expects that there will be a `Pause` transaction before this one |
| 41 | + // but both txs will be signed ahead of time. Need to explicitly override the nonce to |
| 42 | + // ensure that the correct nonce is used in the sign, simulate and execution steps. |
| 43 | + function _getNonce(IGnosisSafe) internal override view returns (uint256 nonce) { |
| 44 | + nonce = vm.envUint("ROLLBACK_NONCE"); |
| 45 | + } |
| 46 | +} |
0 commit comments