-
Notifications
You must be signed in to change notification settings - Fork 118
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 Rollback template to setup templates #149
Open
stevieraykatz
wants to merge
1
commit into
main
Choose a base branch
from
add-tx-pair-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
setup-templates/template-incident/script/RollbackPause.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,46 @@ | ||||||
// SPDX-License-Identifier: MIT | ||||||
pragma solidity 0.8.15; | ||||||
|
||||||
import "@base-contracts/script/universal/MultisigBuilder.sol"; | ||||||
import "@eth-optimism-bedrock/contracts/L1/OptimismPortal.sol"; | ||||||
|
||||||
contract RollbackUnpausePortal is MultisigBuilder { | ||||||
address constant internal OPTIMISM_PORTAL_PROXY = vm.envAddress("OPTIMISM_PORTAL_PROXY"); // TODO: define OPTIMISM_PORTAL_PROXY=xxx in the .env file | ||||||
address constant internal GUARDIAN = vm.envAddress("GUARDIAN"); // TODO: define GUARDIAN=xxx in the .env file | ||||||
|
||||||
function _postCheck() internal override view { | ||||||
OptimismPortal optimismPortal = OptimismPortal(payable(OPTIMISM_PORTAL_PROXY)); | ||||||
require(optimismPortal.paused() == false, "UnpausePortal: Portal did not get unpaused"); | ||||||
} | ||||||
|
||||||
function _buildCalls() internal override view returns (IMulticall3.Call3[] memory) { | ||||||
IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1); | ||||||
|
||||||
calls[0] = IMulticall3.Call3({ | ||||||
target: OPTIMISM_PORTAL_PROXY, | ||||||
allowFailure: false, | ||||||
callData: abi.encodeCall( | ||||||
OptimismPortal.unpause, () | ||||||
) | ||||||
}); | ||||||
|
||||||
return calls; | ||||||
} | ||||||
|
||||||
function _ownerSafe() internal override view returns (address) { | ||||||
return GUARDIAN; | ||||||
} | ||||||
|
||||||
function _addOverrides(address _safe) internal override view returns (SimulationStateOverride memory) { | ||||||
IGnosisSafe safe = IGnosisSafe(payable(_safe)); | ||||||
uint256 _nonce = _getNonce(safe); | ||||||
return overrideSafeThresholdOwnerAndNonce(_safe, DEFAULT_SENDER, _nonce); | ||||||
} | ||||||
|
||||||
// This transaction expects that there will be a `Pause` transaction before this one | ||||||
// but both txs will be signed ahead of time. Need to explicitly override the nonce to | ||||||
// ensure that the correct nonce is used in the sign, simulate and execution steps. | ||||||
function _getNonce(IGnosisSafe) internal override view returns (uint256 nonce) { | ||||||
nonce = vm.envUint("ROLLBACK_NONCE"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.