Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

GovernorVotesUpgradeable

Inherits: Initializable, GovernorUpgradeable

Extension of {Governor} for voting weight extraction from an {ERC20Votes} token, or since v4.5 an {ERC721Votes} token.

State Variables

GovernorVotesStorageLocation

bytes32 private constant GovernorVotesStorageLocation =
    0x3ba4977254e415696610a40ebf2258dbfa0ec6a2ff64e84bfe715ff16977cc00;

Functions

_getGovernorVotesStorage

function _getGovernorVotesStorage() private pure returns (GovernorVotesStorage storage $);

__GovernorVotes_init

function __GovernorVotes_init(IVotes tokenAddress) internal onlyInitializing;

__GovernorVotes_init_unchained

function __GovernorVotes_init_unchained(IVotes tokenAddress) internal onlyInitializing;

token

The token that voting power is sourced from.

function token() public view virtual returns (IERC5805);

clock

Clock (as specified in ERC-6372) is set to match the token's clock. Fallback to block numbers if the token does not implement ERC-6372.

function clock() public view virtual override returns (uint48);

CLOCK_MODE

Machine-readable description of the clock as specified in ERC-6372.

function CLOCK_MODE() public view virtual override returns (string memory);

_getVotes

Read the voting weight from the token's built in snapshot mechanism (see Governor-_getVotes).

function _getVotes(address account, uint256 timepoint, bytes memory) internal view virtual override returns (uint256);

Structs

GovernorVotesStorage

Note: storage-location: erc7201:openzeppelin.storage.GovernorVotes

struct GovernorVotesStorage {
    IERC5805 _token;
}