Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Latest commit

 

History

History
303 lines (250 loc) · 7.7 KB

Pausable.md

File metadata and controls

303 lines (250 loc) · 7.7 KB

Pausable.sol

View Source: openzeppelin-solidity/contracts/security/Pausable.sol

↗ Extends: Context ↘ Derived Contracts: ProtoBase, StoreBase

Pausable

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.

Contract Members

Constants & Variables

bool private _paused;

Events

event Paused(address  account);
event Unpaused(address  account);

Modifiers

whenNotPaused

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

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

Arguments

Name Type Description

whenPaused

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

  • The contract must be paused.
modifier whenPaused() internal

Arguments

Name Type Description

Functions

Initializes the contract in unpaused state.

function () internal nonpayable

Arguments

Name Type Description
Source Code
constructor() {
        _paused = false;
    }

paused

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

function paused() public view
returns(bool)

Arguments

Name Type Description
Source Code
function paused() public view virtual returns (bool) {
        return _paused;
    }

_pause

Triggers stopped state. Requirements:

  • The contract must not be paused.
function _pause() internal nonpayable whenNotPaused 

Arguments

Name Type Description
Source Code
function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

_unpause

Returns to normal state. Requirements:

  • The contract must be paused.
function _unpause() internal nonpayable whenPaused 

Arguments

Name Type Description
Source Code
function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

Contracts