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