Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PausableUpgradeable

Inherits: Initializable, ContextUpgradeable

Contract module which allows children to implement an emergency stop mechanism that can be triggered by an authorized account. This module is used through inheritance. It will make available the modifiers whenNotPaused and whenPaused, which can be applied to the functions of your contract. Note that they will not be pausable by simply including this module, only once the modifiers are put in place.

State Variables

PausableStorageLocation

bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

Functions

_getPausableStorage

function _getPausableStorage() private pure returns (PausableStorage storage $);

whenNotPaused

*Modifier to make a function callable only when the contract is not paused. Requirements:

  • The contract must not be paused.*
modifier whenNotPaused();

whenPaused

*Modifier to make a function callable only when the contract is paused. Requirements:

  • The contract must be paused.*
modifier whenPaused();

__Pausable_init

function __Pausable_init() internal onlyInitializing;

__Pausable_init_unchained

function __Pausable_init_unchained() internal onlyInitializing;

paused

Returns true if the contract is paused, and false otherwise.

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

_requireNotPaused

Throws if the contract is paused.

function _requireNotPaused() internal view virtual;

_requirePaused

Throws if the contract is not paused.

function _requirePaused() internal view virtual;

_pause

*Triggers stopped state. Requirements:

  • The contract must not be paused.*
function _pause() internal virtual whenNotPaused;

_unpause

*Returns to normal state. Requirements:

  • The contract must be paused.*
function _unpause() internal virtual whenPaused;

Events

Paused

Emitted when the pause is triggered by account.

event Paused(address account);

Unpaused

Emitted when the pause is lifted by account.

event Unpaused(address account);

Errors

EnforcedPause

The operation failed because the contract is paused.

error EnforcedPause();

ExpectedPause

The operation failed because the contract is not paused.

error ExpectedPause();

Structs

PausableStorage

Note: storage-location: erc7201:openzeppelin.storage.Pausable

struct PausableStorage {
    bool _paused;
}