Skip to main content

PausableOwnable

PausableOwnable

This abstract contract extracts a common part of the emergency stop mechanism. The emergency stop mechanism can be triggered by an authorized account. Only owner of the contract can update pause admin address.

pauseAdmin

address pauseAdmin

An authorized account that can trigger emergency stop mechanism.

PauseAdminUpdated

event PauseAdminUpdated(address newAccount, address oldAccount)

Emitted when a pause admin address is updated.

Parameters

NameTypeDescription
newAccountaddressNew pause admin address.
oldAccountaddressOld pause admin address.

PausableUnauthorizedAccount

error PausableUnauthorizedAccount(address account)

Reverts when an unauthorized account triggers the emergency stop mechanism.

SamePauseAdmin

error SamePauseAdmin()

Reverts when the new pause admin address is the same as the current pause admin address.

onlyPauseAdminOrOwner

modifier onlyPauseAdminOrOwner()

Reverts if called by any account other than the pause admin or the contract owner.

__PausableOwnable_init

function __PausableOwnable_init(address initialOwner, address initialPauseAdmin) internal

Initializes the contract. MUST BE CALLED from the child contract initializer.

Parameters

NameTypeDescription
initialOwneraddressInitial owner of the contract.
initialPauseAdminaddressInitial emergency stop account that can trigger the emergency stop mechanism.

__PausableOwnable_init_unchained

function __PausableOwnable_init_unchained(address initialPauseAdmin) internal

pause

function pause() external

Enables an emergency stop mechanism.

_Requirements:

  • The caller must be an authorized account to trigger pause.
  • The contract must not be already paused._

unpause

function unpause() external

Turns off the emergency stop mechanism.

_Requirements:

  • The caller must be an authorized account to trigger unpause.
  • The contract must be paused._

updatePauseAdmin

function updatePauseAdmin(address newPauseAdmin) external

Updates an authorized account that can trigger emergency stop mechanism.

Throws if called by any account other than the owner.

Parameters

NameTypeDescription
newPauseAdminaddressNew account that can trigger emergency stop mechanism.