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

GovernorStorageUpgradeable

Inherits: Initializable, GovernorUpgradeable

*Extension of {Governor} that implements storage of proposal details. This modules also provides primitives for the enumerability of proposals. Use cases for this module include:

  • UIs that explore the proposal state without relying on event indexing.
  • Using only the proposalId as an argument in the {Governor-queue} and {Governor-execute} functions for L2 chains where storage is cheap compared to calldata.*

State Variables

GovernorStorageStorageLocation

bytes32 private constant GovernorStorageStorageLocation =
    0x7fd223d3380145bd26132714391e777c488a0df7ac2dd4b66419d8549fb3a600;

Functions

_getGovernorStorageStorage

function _getGovernorStorageStorage() private pure returns (GovernorStorageStorage storage $);

__GovernorStorage_init

function __GovernorStorage_init() internal onlyInitializing;

__GovernorStorage_init_unchained

function __GovernorStorage_init_unchained() internal onlyInitializing;

_propose

Hook into the proposing mechanism

function _propose(
    address[] memory targets,
    uint256[] memory values,
    bytes[] memory calldatas,
    string memory description,
    address proposer
) internal virtual override returns (uint256);

queue

Version of IGovernor-queue with only proposalId as an argument.

function queue(uint256 proposalId) public virtual;

execute

Version of IGovernor-execute with only proposalId as an argument.

function execute(uint256 proposalId) public payable virtual;

cancel

ProposalId version of IGovernor-cancel.

function cancel(uint256 proposalId) public virtual;

proposalCount

Returns the number of stored proposals.

function proposalCount() public view virtual returns (uint256);

proposalDetails

Returns the details of a proposalId. Reverts if proposalId is not a known proposal.

function proposalDetails(uint256 proposalId)
    public
    view
    virtual
    returns (address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash);

proposalDetailsAt

Returns the details (including the proposalId) of a proposal given its sequential index.

function proposalDetailsAt(uint256 index)
    public
    view
    virtual
    returns (
        uint256 proposalId,
        address[] memory targets,
        uint256[] memory values,
        bytes[] memory calldatas,
        bytes32 descriptionHash
    );

Structs

ProposalDetails

struct ProposalDetails {
    address[] targets;
    uint256[] values;
    bytes[] calldatas;
    bytes32 descriptionHash;
}

GovernorStorageStorage

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

struct GovernorStorageStorage {
    uint256[] _proposalIds;
    mapping(uint256 proposalId => ProposalDetails) _proposalDetails;
}