GovernorSequentialProposalIdUpgradeable
Inherits: Initializable, GovernorUpgradeable
Extension of {Governor} that changes the numbering of proposal ids from the default hash-based approach to sequential ids.
State Variables
GovernorSequentialProposalIdStorageLocation
bytes32 private constant GovernorSequentialProposalIdStorageLocation =
0x4b8c47b641115bbb755a0530712d89d8042b41728d36570a6119c90ae1b76800;
Functions
_getGovernorSequentialProposalIdStorage
function _getGovernorSequentialProposalIdStorage()
private
pure
returns (GovernorSequentialProposalIdStorage storage $);
__GovernorSequentialProposalId_init
function __GovernorSequentialProposalId_init() internal onlyInitializing;
__GovernorSequentialProposalId_init_unchained
function __GovernorSequentialProposalId_init_unchained() internal onlyInitializing;
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();
Structs
GovernorSequentialProposalIdStorage
Note: storage-location: erc7201:openzeppelin.storage.GovernorSequentialProposalId
struct GovernorSequentialProposalIdStorage {
uint256 _latestProposalId;
mapping(uint256 proposalHash => uint256 proposalId) _proposalIds;
}