Skip to main content

Governor

Governor

Dev note

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

ChainAddress

Functions

constructor

constructor(address initialGovernor) internal
Dev note

Initializes the contract setting the address provided by the deployer as the initial governor.

transferGovernor

function transferGovernor(address newGovernor) public virtual
Dev note

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
Dev note

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
Dev note

The new governor accepts the governorship transfer.

_checkGovernor

function _checkGovernor() internal view virtual
Dev note

Throws if the sender is not the governor.

pendingGovernor

function pendingGovernor() public view virtual returns (address)
Dev note

Returns the address of the pending governor.

governor

function governor() public view virtual returns (address)
Dev note

Returns the address of the current governor.

Modifiers

onlyGovernor

modifier onlyGovernor()
Dev note

Throws if called by any account other than the governor.