Guardian
Guardian
Contract module which provides access control mechanism, where there is an account (an guardian) that can be granted exclusive access to specific functions.
The initial guardian is specified at deployment time in the constructor for Guardian
. This
can later be changed with {transferGuardian} and {acceptGuardian}.
This module is used through inheritance. It will make available all functions from parent (Guardian).
Modified from the OpenZeppelin Contracts library (5.0.0)
Addresses
Chain | Address |
---|
Functions
constructor
constructor(address initialGuardian) internal
Initializes the contract setting the address provided by the deployer as the initial guardian.
transferGuardian
function transferGuardian(address newGuardian) public virtual
Starts the guardianship transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current guardian.
_transferGuardian
function _transferGuardian(address newGuardian) internal virtual
Transfers guardianship of the contract to a new account (newGuardian
) and deletes any pending guardian.
Internal function without access restriction.
acceptGuardian
function acceptGuardian() public virtual
The new guardian accepts the guardianship transfer.
_checkGuardian
function _checkGuardian() internal view virtual
Throws if the sender is not the guardian.
pendingGuardian
function pendingGuardian() public view virtual returns (address)
Returns the address of the pending guardian.
guardian
function guardian() public view virtual returns (address)
Returns the address of the current guardian.
Modifiers
onlyGuardian
modifier onlyGuardian()
Throws if called by any account other than the guardian.