diff --git a/src/gov-action-contracts/pause-all/PauseAllAction.sol b/src/gov-action-contracts/pause-all/PauseAllAction.sol new file mode 100644 index 00000000..1bd040a3 --- /dev/null +++ b/src/gov-action-contracts/pause-all/PauseAllAction.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.16; + +import "../address-registries/interfaces.sol"; +import "../set-outbox/OutboxActionLib.sol"; +import "../sequencer/SequencerActionLib.sol"; + +/// @notice pause inbox and rollup, remove all outboxes and sequencers +contract PauseAllAction { + IL1AddressRegistry public immutable addressRegistry; + address[] sequencersToRemove; + + constructor(IL1AddressRegistry _addressRegistry, address[] memory _sequencersToRemove) { + addressRegistry = _addressRegistry; + sequencersToRemove = _sequencersToRemove; + } + + function perform() external { + addressRegistry.inbox().pause(); + addressRegistry.rollup().pause(); + OutboxActionLib.bridgeRemoveAllOutboxes(addressRegistry); + for (uint256 i = 0; i < sequencersToRemove.length; i++) { + SequencerActionLib.removeSequencer(addressRegistry, sequencersToRemove[i]); + } + } +} diff --git a/src/gov-action-contracts/pause-all/UnpauseAllAction.sol b/src/gov-action-contracts/pause-all/UnpauseAllAction.sol new file mode 100644 index 00000000..60d90b27 --- /dev/null +++ b/src/gov-action-contracts/pause-all/UnpauseAllAction.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.16; + +import "../address-registries/interfaces.sol"; +import "../set-outbox/OutboxActionLib.sol"; +import "../sequencer/SequencerActionLib.sol"; + +/// @notice unpause inbox and rollup, add outboxes and sequencers (i.e., undoes PauseAllAction) +contract UnPauseAllAction { + IL1AddressRegistry public immutable addressRegistry; + address[] sequencersToAdd; + address[] outboxesToAdd; + + constructor( + IL1AddressRegistry _addressRegistry, + address[] memory _sequencersToAdd, + address[] memory outboxesToAdd + ) { + addressRegistry = _addressRegistry; + sequencersToAdd = _sequencersToAdd; + outboxesToAdd = outboxesToAdd; + } + + function perform() external { + addressRegistry.inbox().unpause(); + addressRegistry.rollup().resume(); + OutboxActionLib.bridgeAddOutboxes(addressRegistry, outboxesToAdd); + for (uint256 i = 0; i < sequencersToAdd.length; i++) { + SequencerActionLib.addSequencer(addressRegistry, sequencersToAdd[i]); + } + } +} diff --git a/src/gov-action-contracts/set-outbox/OutboxActionLib.sol b/src/gov-action-contracts/set-outbox/OutboxActionLib.sol index ee7f57da..2e356e52 100644 --- a/src/gov-action-contracts/set-outbox/OutboxActionLib.sol +++ b/src/gov-action-contracts/set-outbox/OutboxActionLib.sol @@ -6,9 +6,7 @@ import "@openzeppelin/contracts/utils/Address.sol"; import "@arbitrum/nitro-contracts/src/bridge/IOutbox.sol"; library OutboxActionLib { - function bridgeAddOutboxes(IBridgeGetter addressRegistry, address[] calldata outboxes) - internal - { + function bridgeAddOutboxes(IBridgeGetter addressRegistry, address[] memory outboxes) internal { IBridge bridge = addressRegistry.bridge(); for (uint256 i = 0; i < outboxes.length; i++) { address outbox = outboxes[i]; @@ -20,7 +18,7 @@ library OutboxActionLib { } } - function bridgeRemoveOutboxes(IBridgeGetter addressRegistry, address[] calldata outboxes) + function bridgeRemoveOutboxes(IBridgeGetter addressRegistry, address[] memory outboxes) internal { IBridge bridge = addressRegistry.bridge();