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

GovernorStorage

Inherits: Governor

*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

_proposalIds

uint256[] private _proposalIds;

_proposalDetails

mapping(uint256 proposalId => ProposalDetails) private _proposalDetails;

Functions

_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;
}