github.com/ethereum-optimism/optimism@v1.7.2/packages/contracts-bedrock/test/ExtendedPause.t.sol (about)

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity 0.8.15;
     3  
     4  import { CommonTest } from "test/setup/CommonTest.sol";
     5  import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
     6  
     7  /// @dev These tests are somewhat redundant with tests in the SuperchainConfig and other pausable contracts, however
     8  ///      it is worthwhile to pull them into one location to ensure that the behavior is consistent.
     9  contract ExtendedPause_Test is CommonTest {
    10      /// @dev Tests that other contracts are paused when the superchain config is paused
    11      function test_pause_fullSystem_succeeds() public {
    12          assertFalse(superchainConfig.paused());
    13  
    14          vm.prank(superchainConfig.guardian());
    15          superchainConfig.pause("identifier");
    16  
    17          // validate the paused state
    18          assertTrue(superchainConfig.paused());
    19          assertTrue(optimismPortal.paused());
    20          assertTrue(l1CrossDomainMessenger.paused());
    21          assertTrue(l1StandardBridge.paused());
    22          assertTrue(l1ERC721Bridge.paused());
    23      }
    24  
    25      /// @dev Tests that other contracts are unpaused when the superchain config is paused and then unpaused.
    26      function test_unpause_fullSystem_succeeds() external {
    27          // first use the test above to pause the system
    28          test_pause_fullSystem_succeeds();
    29  
    30          vm.prank(superchainConfig.guardian());
    31          superchainConfig.unpause();
    32  
    33          // validate the unpaused state
    34          assertFalse(superchainConfig.paused());
    35          assertFalse(optimismPortal.paused());
    36          assertFalse(l1CrossDomainMessenger.paused());
    37          assertFalse(l1StandardBridge.paused());
    38          assertFalse(l1ERC721Bridge.paused());
    39      }
    40  }