Skip to content
Lattice

IEmergencyStop

Git Source

Title: IEmergencyStop

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

Interface for the EmergencyStop module — a multi-guardian emergency pause where any guardian can trip the stop, but only an admin can resume operations.

Functions

isStopped

Returns whether the emergency stop is currently active.

function isStopped() external view 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) external view 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() external view 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) external;

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() external;

addGuardian

Grants the guardian role to guardian.

Requires DEFAULT_ADMIN_ROLE. Emits GuardianAdded.

function addGuardian(address guardian) external;

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) external;

Parameters

NameTypeDescription
guardianaddressThe address to revoke guardian status from.

Events

EmergencyStopped

Emitted when a guardian trips the emergency stop.

event EmergencyStopped(address indexed guardian, string reason);

Parameters

NameTypeDescription
guardianaddressThe address of the guardian that triggered the stop.
reasonstringA human-readable description of why the stop was triggered.

EmergencyResumed

Emitted when an admin resumes operations after an emergency stop.

event EmergencyResumed(address indexed admin);

Parameters

NameTypeDescription
adminaddressThe address of the admin that resumed operations.

GuardianAdded

Emitted when a new guardian is added.

event GuardianAdded(address indexed guardian);

Parameters

NameTypeDescription
guardianaddressThe address granted guardian status.

GuardianRemoved

Emitted when a guardian is removed.

event GuardianRemoved(address indexed guardian);

Parameters

NameTypeDescription
guardianaddressThe address that lost guardian status.

Errors

EmergencyStopActive

Thrown when an operation is blocked because the emergency stop is active.

error EmergencyStopActive();

EmergencyStopNotActive

Thrown when emergencyResume is called but the stop is not active.

error EmergencyStopNotActive();

EmergencyStopUnauthorizedGuardian

Thrown when a caller without the guardian role attempts emergencyStop.

error EmergencyStopUnauthorizedGuardian(address caller);

Parameters

NameTypeDescription
calleraddressThe address that attempted the unauthorized stop.