IGovernor
Title: IGovernor
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/IGovernor.sol)
Interface for the Governor module, implementing on-chain governance with proposal lifecycle, voting, quorum, and optional TimelockController integration.
Mirrors the OpenZeppelin v5 Governor interface combined with GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, and GovernorTimelockControl extensions in a single monolithic interface.
Functions
name
The human-readable name of this governor.
function name() external view returns (string memory);Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
version
The version string ("1").
function version() external view returns (string memory);Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
token
The IVotes token used for voting power.
function token() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
clock
The current clock value (block.timestamp in uint48).
function clock() external view returns (uint48);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint48 |
CLOCK_MODE
Machine-readable clock mode string.
function CLOCK_MODE() external view returns (string memory);Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
COUNTING_MODE
Machine-readable counting mode string.
function COUNTING_MODE() external view returns (string memory);Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
votingDelay
Delay (in clock units) between proposal creation and the start of voting.
function votingDelay() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
votingPeriod
Duration (in clock units) of the voting period.
function votingPeriod() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
proposalThreshold
Minimum voting power required to create a proposal.
function proposalThreshold() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
quorum
The quorum required at a given timepoint (in token units).
function quorum(uint256 timepoint) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| timepoint | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
quorumNumerator
The current quorum numerator (out of quorumDenominator).
function quorumNumerator() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
quorumNumerator
The quorum numerator at a given timepoint (historical or current).
function quorumNumerator(uint256 timepoint) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| timepoint | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
quorumDenominator
The quorum denominator (100 for percentage-based quorum).
function quorumDenominator() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
timelock
The configured TimelockController address (address(0) if none).
function timelock() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
state
Returns the current state of a proposal.
function state(uint256 proposalId) external view returns (ProposalState);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | ProposalState |
proposalSnapshot
The clock value at which voting starts for a proposal.
function proposalSnapshot(uint256 proposalId) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
proposalDeadline
The clock value at which voting ends for a proposal.
function proposalDeadline(uint256 proposalId) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
proposalProposer
The address that created a proposal.
function proposalProposer(uint256 proposalId) external view returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
proposalEta
The timelock ETA (in seconds) for a queued proposal (0 if not queued).
function proposalEta(uint256 proposalId) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
proposalVotes
Returns the vote totals for a proposal.
function proposalVotes(uint256 proposalId)
external
view
returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| againstVotes | uint256 | |
| forVotes | uint256 | |
| abstainVotes | uint256 |
hasVoted
Returns whether an account has voted on a proposal.
function hasVoted(uint256 proposalId, address account) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| account | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
getVotes
Returns the voting power of an account at a past timepoint.
function getVotes(address account, uint256 timepoint) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| timepoint | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
hashProposal
Computes the proposal ID for a given set of actions and description.
function hashProposal(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external pure returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| calldatas | bytes[] | |
| descriptionHash | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
propose
Create a new proposal.
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) external returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| calldatas | bytes[] | |
| description | string |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
queue
Queue a succeeded proposal in the timelock.
function queue(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
external
returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| calldatas | bytes[] | |
| descriptionHash | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
execute
Execute a succeeded (or queued+ready) proposal. A queued proposal past its grace period is Expired and can no longer be executed.
function execute(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external payable returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| calldatas | bytes[] | |
| descriptionHash | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
cancel
Cancel a proposal before voting starts (proposer only, Pending state only).
function cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| calldatas | bytes[] | |
| descriptionHash | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
castVote
Cast a vote on an active proposal.
function castVote(uint256 proposalId, uint8 support) external returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| support | uint8 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
castVoteWithReason
Cast a vote with a reason string.
function castVoteWithReason(uint256 proposalId, uint8 support, string calldata reason) external returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| support | uint8 | |
| reason | string |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
castVoteBySig
Cast a vote via an EIP-712 signature.
function castVoteBySig(uint256 proposalId, uint8 support, address voter, bytes memory signature)
external
returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| support | uint8 | |
| voter | address | |
| signature | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
castVoteWithReasonAndParams
Cast a vote with a reason string and extra params.
function castVoteWithReasonAndParams(
uint256 proposalId,
uint8 support,
string calldata reason,
bytes calldata params
) external returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| support | uint8 | |
| reason | string | |
| params | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
setVotingDelay
Update the voting delay. Must be called via governance (address(this)).
function setVotingDelay(uint48 newVotingDelay) external;Parameters
| Name | Type | Description |
|---|---|---|
| newVotingDelay | uint48 |
setVotingPeriod
Update the voting period. Must be called via governance (address(this)).
function setVotingPeriod(uint32 newVotingPeriod) external;Parameters
| Name | Type | Description |
|---|---|---|
| newVotingPeriod | uint32 |
setProposalThreshold
Update the proposal threshold. Must be called via governance (address(this)).
function setProposalThreshold(uint256 newProposalThreshold) external;Parameters
| Name | Type | Description |
|---|---|---|
| newProposalThreshold | uint256 |
updateQuorumNumerator
Update the quorum numerator. Must be called via governance (address(this)).
function updateQuorumNumerator(uint256 newQuorumNumerator) external;Parameters
| Name | Type | Description |
|---|---|---|
| newQuorumNumerator | uint256 |
updateTimelock
Update the timelock address. Must be called via governance (address(this)).
function updateTimelock(address newTimelock) external;Parameters
| Name | Type | Description |
|---|---|---|
| newTimelock | address |
Events
ProposalCreated
Emitted when a new proposal is created.
event ProposalCreated(
uint256 proposalId,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 voteStart,
uint256 voteEnd,
string description
);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| proposer | address | |
| targets | address[] | |
| values | uint256[] | |
| signatures | string[] | |
| calldatas | bytes[] | |
| voteStart | uint256 | |
| voteEnd | uint256 | |
| description | string |
ProposalQueued
Emitted when a proposal is queued in the timelock.
event ProposalQueued(uint256 proposalId, uint256 etaSeconds);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| etaSeconds | uint256 |
ProposalExecuted
Emitted when a proposal is executed.
event ProposalExecuted(uint256 proposalId);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
ProposalCanceled
Emitted when a proposal is canceled.
event ProposalCanceled(uint256 proposalId);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
VoteCast
Emitted when a vote is cast (without extra params).
event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);Parameters
| Name | Type | Description |
|---|---|---|
| voter | address | |
| proposalId | uint256 | |
| support | uint8 | |
| weight | uint256 | |
| reason | string |
VoteCastWithParams
Emitted when a vote is cast with extra params.
event VoteCastWithParams(
address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason, bytes params
);Parameters
| Name | Type | Description |
|---|---|---|
| voter | address | |
| proposalId | uint256 | |
| support | uint8 | |
| weight | uint256 | |
| reason | string | |
| params | bytes |
VotingDelaySet
Emitted when the voting delay is updated.
event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay);Parameters
| Name | Type | Description |
|---|---|---|
| oldVotingDelay | uint256 | |
| newVotingDelay | uint256 |
VotingPeriodSet
Emitted when the voting period is updated.
event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod);Parameters
| Name | Type | Description |
|---|---|---|
| oldVotingPeriod | uint256 | |
| newVotingPeriod | uint256 |
ProposalThresholdSet
Emitted when the proposal threshold is updated.
event ProposalThresholdSet(uint256 oldProposalThreshold, uint256 newProposalThreshold);Parameters
| Name | Type | Description |
|---|---|---|
| oldProposalThreshold | uint256 | |
| newProposalThreshold | uint256 |
QuorumNumeratorUpdated
Emitted when the quorum numerator is updated.
event QuorumNumeratorUpdated(uint256 oldNumerator, uint256 newNumerator);Parameters
| Name | Type | Description |
|---|---|---|
| oldNumerator | uint256 | |
| newNumerator | uint256 |
TimelockChange
Emitted when the timelock controller address is updated.
event TimelockChange(address indexed oldTimelock, address indexed newTimelock);Parameters
| Name | Type | Description |
|---|---|---|
| oldTimelock | address | |
| newTimelock | address |
Errors
GovernorAlreadyCastVote
Thrown when a voter has already cast a vote on a proposal.
error GovernorAlreadyCastVote(address voter);Parameters
| Name | Type | Description |
|---|---|---|
| voter | address |
GovernorDisabledDeposit
Thrown when a deposit-based action is attempted but deposits are disabled.
error GovernorDisabledDeposit();GovernorOnlyExecutor
Thrown when a caller is not the executor (address(this) for direct execution).
error GovernorOnlyExecutor(address account);Parameters
| Name | Type | Description |
|---|---|---|
| account | address |
GovernorNonexistentProposal
Thrown when a proposal does not exist.
error GovernorNonexistentProposal(uint256 proposalId);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
GovernorUnexpectedProposalState
Thrown when a proposal is in an unexpected state for the requested action.
error GovernorUnexpectedProposalState(uint256 proposalId, ProposalState current, bytes32 expectedStates);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 | |
| current | ProposalState | |
| expectedStates | bytes32 |
GovernorInvalidVotingPeriod
Thrown when the voting period is zero or otherwise invalid.
error GovernorInvalidVotingPeriod(uint256 votingPeriod);Parameters
| Name | Type | Description |
|---|---|---|
| votingPeriod | uint256 |
GovernorInsufficientProposerVotes
Thrown when the proposer lacks sufficient voting power.
error GovernorInsufficientProposerVotes(address proposer, uint256 votes, uint256 threshold);Parameters
| Name | Type | Description |
|---|---|---|
| proposer | address | |
| votes | uint256 | |
| threshold | uint256 |
GovernorInvalidProposalLength
Thrown when proposal arrays (targets, calldatas, values) have mismatched lengths.
error GovernorInvalidProposalLength(uint256 targets, uint256 calldatas, uint256 values);Parameters
| Name | Type | Description |
|---|---|---|
| targets | uint256 | |
| calldatas | uint256 | |
| values | uint256 |
GovernorAlreadyQueuedProposal
Thrown when a proposal is already queued in the timelock.
error GovernorAlreadyQueuedProposal(uint256 proposalId);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
GovernorNotQueuedProposal
Thrown when a proposal is not queued but execution expects it to be.
error GovernorNotQueuedProposal(uint256 proposalId);Parameters
| Name | Type | Description |
|---|---|---|
| proposalId | uint256 |
GovernorQueueNotImplemented
Thrown when queue() is called but no timelock is configured.
error GovernorQueueNotImplemented();GovernorInvalidQuorumFraction
Thrown when the quorum numerator exceeds the denominator.
error GovernorInvalidQuorumFraction(uint256 quorumNumerator, uint256 quorumDenominator);Parameters
| Name | Type | Description |
|---|---|---|
| quorumNumerator | uint256 | |
| quorumDenominator | uint256 |
GovernorInvalidSignature
Thrown when an EIP-712 signature is invalid for the expected voter.
error GovernorInvalidSignature(address voter);Parameters
| Name | Type | Description |
|---|---|---|
| voter | address |
GovernorInvalidVoteType
Thrown when a vote is cast with an unrecognized support value (> 2).
error GovernorInvalidVoteType();Enums
ProposalState
The lifecycle state of a proposal.
Pending=0, Active=1, Canceled=2, Defeated=3, Succeeded=4, Queued=5, Expired=6, Executed=7
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}Variants
| Name | Description |
|---|---|
| Pending | |
| Active | |
| Canceled | |
| Defeated | |
| Succeeded | |
| Queued | |
| Expired | |
| Executed |
VoteType
The type of vote cast by a voter.
Against=0, For=1, Abstain=2 (Bravo counting)
enum VoteType {
Against,
For,
Abstain
}Variants
| Name | Description |
|---|---|
| Against | |
| For | |
| Abstain |