GovernorSequentialProposalId
Inherits: Governor
Extension of {Governor} that changes the numbering of proposal ids from the default hash-based approach to sequential ids.
State Variables
_latestProposalId
uint256 private _latestProposalId;
_proposalIds
mapping(uint256 proposalHash => uint256 proposalId) private _proposalIds;
Functions
getProposalId
module:core
Function used to get the proposal id from the proposal details.
function getProposalId(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) public view virtual override returns (uint256);
latestProposalId
Returns the latest proposal id. A return value of 0 means no proposals have been created yet.
function latestProposalId() public view virtual returns (uint256);
_propose
See IGovernor-_propose. Hook into the proposing mechanism to increment proposal count.
function _propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description,
address proposer
) internal virtual override returns (uint256);
_initializeLatestProposalId
Internal function to set the latestProposalId. This function is helpful when transitioning
from another governance system. The next proposal id will be newLatestProposalId + 1.
May only call this function if the current value of {latestProposalId} is 0.
function _initializeLatestProposalId(uint256 newLatestProposalId) internal virtual;
Errors
GovernorAlreadyInitializedLatestProposalId
The latestProposalId may only be initialized if it hasn't been set yet (through initialization or the creation of a proposal).
error GovernorAlreadyInitializedLatestProposalId();