Skip to content
Lattice

EmergencyStop

Git Source

Inherits: IEmergencyStop

Title: EmergencyStop

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Pausable.sol)

Thin Diamond facet that exposes multi-guardian emergency stop functionality.

All logic lives in EmergencyStopLib. This contract is stateless and forwards every call to the library. Inherit this in your Diamond facet to add emergency-stop.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin v5.1.0

Functions

isStopped

Returns whether the emergency stop is currently active.

function isStopped() public view virtual returns (bool);

Returns

NameTypeDescription
<none>boolbool True if the system is stopped, false otherwise.

isGuardian

Returns whether account holds the guardian role.

function isGuardian(address account) public view virtual returns (bool);

Parameters

NameTypeDescription
accountaddressThe address to query.

Returns

NameTypeDescription
<none>boolbool True if the account is a guardian.

stoppedReason

Returns the reason string recorded when the emergency stop was last triggered.

function stoppedReason() public view virtual returns (string memory);

Returns

NameTypeDescription
<none>stringstring The reason for the last emergency stop (empty if never stopped).

emergencyStop

Activates the emergency stop.

Requires the caller to hold the guardian role (EMERGENCY_GUARDIAN_ROLE). Reverts with EmergencyStopActive if the stop is already active. Emits EmergencyStopped.

function emergencyStop(string calldata reason) public virtual;

Parameters

NameTypeDescription
reasonstringA human-readable description of why the stop is being triggered.

emergencyResume

Resumes operations after an emergency stop.

Requires DEFAULT_ADMIN_ROLE. Reverts with EmergencyStopNotActive if not stopped. Emits EmergencyResumed.

function emergencyResume() public virtual;

addGuardian

Grants the guardian role to guardian.

Requires DEFAULT_ADMIN_ROLE. Emits GuardianAdded.

function addGuardian(address guardian) public virtual;

Parameters

NameTypeDescription
guardianaddressThe address to grant guardian status.

removeGuardian

Revokes the guardian role from guardian.

Requires DEFAULT_ADMIN_ROLE. Emits GuardianRemoved.

function removeGuardian(address guardian) public virtual;

Parameters

NameTypeDescription
guardianaddressThe address to revoke guardian status from.

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect EmergencyStop methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: addGuardian(address) 0xa526d83b emergencyResume() 0x93c87f03 emergencyStop(string) 0xb1e3268b isGuardian(address) 0x0c68ba21 isStopped() 0x3f683b6a removeGuardian(address) 0x71404156 stoppedReason() 0x5b0b0c07

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes