Skip to content
Lattice

PausableLib

Git Source

Title: Pausable Library

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Pausable.sol)

Library implementing pausable lifecycle control for Diamond facets.

Pause/unpause is restricted to the DEFAULT_ADMIN_ROLE via AccessControlLib.

Functions

pausableStorage

Returns the storage struct for Pausable at its ERC-7201 slot.

function pausableStorage() internal pure returns (PausableStorage storage $);

Returns

NameTypeDescription
$PausableStorage

registerInterface

Registers support for the IPausable interface via ERC-165.

Writes true to the precomputed ERC-165 map slot.

function registerInterface() internal;

__Pausable_init

Initializes the Pausable module — ERC-165 registration only.

Must be called inside an initializer-guarded function (see Initializable); compose it from any diamond init that cuts Pausable — there is no dedicated init contract. _paused needs no seeding (false is the zero default). Deliberate divergence from OZ (which registers nothing): diamonds rely on ERC-165 discovery, so the IPausable interfaceId is registered here.

function __Pausable_init() internal;

paused

Returns whether the contract is currently paused.

function paused() internal view returns (bool);

Returns

NameTypeDescription
<none>boolbool True if paused, false otherwise.

checkNotPaused

Reverts if the contract is paused.

Use at the start of functions that must not execute while paused — or inherit the Pausable facade and use its whenNotPaused modifier.

function checkNotPaused() internal view;

checkPaused

Reverts if the contract is NOT paused.

Use in functions that require the contract to be paused — or inherit the Pausable facade and use its whenPaused modifier.

function checkPaused() internal view;

pause

Pauses the contract.

Requires the caller to hold DEFAULT_ADMIN_ROLE. Reverts with EnforcedPause if already paused. Emits Paused event.

function pause() internal;

unpause

Unpauses the contract.

Requires the caller to hold DEFAULT_ADMIN_ROLE. Reverts with ExpectedPause if not paused. Emits Unpaused event.

function unpause() internal;

_pause

Raw pause — sets paused state to true and emits Paused.

No auth check; callers must enforce authorization before calling this.

function _pause() internal;

_unpause

Raw unpause — sets paused state to false and emits Unpaused.

No auth check; callers must enforce authorization before calling this.

function _unpause() internal;