Skip to content
Lattice

IGovernor

Git Source

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

NameTypeDescription
<none>string

version

The version string ("1").

function version() external view returns (string memory);

Returns

NameTypeDescription
<none>string

token

The IVotes token used for voting power.

function token() external view returns (address);

Returns

NameTypeDescription
<none>address

clock

The current clock value (block.timestamp in uint48).

function clock() external view returns (uint48);

Returns

NameTypeDescription
<none>uint48

CLOCK_MODE

Machine-readable clock mode string.

function CLOCK_MODE() external view returns (string memory);

Returns

NameTypeDescription
<none>string

COUNTING_MODE

Machine-readable counting mode string.

function COUNTING_MODE() external view returns (string memory);

Returns

NameTypeDescription
<none>string

votingDelay

Delay (in clock units) between proposal creation and the start of voting.

function votingDelay() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

votingPeriod

Duration (in clock units) of the voting period.

function votingPeriod() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

proposalThreshold

Minimum voting power required to create a proposal.

function proposalThreshold() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

quorum

The quorum required at a given timepoint (in token units).

function quorum(uint256 timepoint) external view returns (uint256);

Parameters

NameTypeDescription
timepointuint256

Returns

NameTypeDescription
<none>uint256

quorumNumerator

The current quorum numerator (out of quorumDenominator).

function quorumNumerator() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

quorumNumerator

The quorum numerator at a given timepoint (historical or current).

function quorumNumerator(uint256 timepoint) external view returns (uint256);

Parameters

NameTypeDescription
timepointuint256

Returns

NameTypeDescription
<none>uint256

quorumDenominator

The quorum denominator (100 for percentage-based quorum).

function quorumDenominator() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

timelock

The configured TimelockController address (address(0) if none).

function timelock() external view returns (address);

Returns

NameTypeDescription
<none>address

state

Returns the current state of a proposal.

function state(uint256 proposalId) external view returns (ProposalState);

Parameters

NameTypeDescription
proposalIduint256

Returns

NameTypeDescription
<none>ProposalState

proposalSnapshot

The clock value at which voting starts for a proposal.

function proposalSnapshot(uint256 proposalId) external view returns (uint256);

Parameters

NameTypeDescription
proposalIduint256

Returns

NameTypeDescription
<none>uint256

proposalDeadline

The clock value at which voting ends for a proposal.

function proposalDeadline(uint256 proposalId) external view returns (uint256);

Parameters

NameTypeDescription
proposalIduint256

Returns

NameTypeDescription
<none>uint256

proposalProposer

The address that created a proposal.

function proposalProposer(uint256 proposalId) external view returns (address);

Parameters

NameTypeDescription
proposalIduint256

Returns

NameTypeDescription
<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

NameTypeDescription
proposalIduint256

Returns

NameTypeDescription
<none>uint256

proposalVotes

Returns the vote totals for a proposal.

function proposalVotes(uint256 proposalId)
        external
        view
        returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes);

Parameters

NameTypeDescription
proposalIduint256

Returns

NameTypeDescription
againstVotesuint256
forVotesuint256
abstainVotesuint256

hasVoted

Returns whether an account has voted on a proposal.

function hasVoted(uint256 proposalId, address account) external view returns (bool);

Parameters

NameTypeDescription
proposalIduint256
accountaddress

Returns

NameTypeDescription
<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

NameTypeDescription
accountaddress
timepointuint256

Returns

NameTypeDescription
<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

NameTypeDescription
targetsaddress[]
valuesuint256[]
calldatasbytes[]
descriptionHashbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
targetsaddress[]
valuesuint256[]
calldatasbytes[]
descriptionstring

Returns

NameTypeDescription
<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

NameTypeDescription
targetsaddress[]
valuesuint256[]
calldatasbytes[]
descriptionHashbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
targetsaddress[]
valuesuint256[]
calldatasbytes[]
descriptionHashbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
targetsaddress[]
valuesuint256[]
calldatasbytes[]
descriptionHashbytes32

Returns

NameTypeDescription
<none>uint256

castVote

Cast a vote on an active proposal.

function castVote(uint256 proposalId, uint8 support) external returns (uint256);

Parameters

NameTypeDescription
proposalIduint256
supportuint8

Returns

NameTypeDescription
<none>uint256

castVoteWithReason

Cast a vote with a reason string.

function castVoteWithReason(uint256 proposalId, uint8 support, string calldata reason) external returns (uint256);

Parameters

NameTypeDescription
proposalIduint256
supportuint8
reasonstring

Returns

NameTypeDescription
<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

NameTypeDescription
proposalIduint256
supportuint8
voteraddress
signaturebytes

Returns

NameTypeDescription
<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

NameTypeDescription
proposalIduint256
supportuint8
reasonstring
paramsbytes

Returns

NameTypeDescription
<none>uint256

setVotingDelay

Update the voting delay. Must be called via governance (address(this)).

function setVotingDelay(uint48 newVotingDelay) external;

Parameters

NameTypeDescription
newVotingDelayuint48

setVotingPeriod

Update the voting period. Must be called via governance (address(this)).

function setVotingPeriod(uint32 newVotingPeriod) external;

Parameters

NameTypeDescription
newVotingPerioduint32

setProposalThreshold

Update the proposal threshold. Must be called via governance (address(this)).

function setProposalThreshold(uint256 newProposalThreshold) external;

Parameters

NameTypeDescription
newProposalThresholduint256

updateQuorumNumerator

Update the quorum numerator. Must be called via governance (address(this)).

function updateQuorumNumerator(uint256 newQuorumNumerator) external;

Parameters

NameTypeDescription
newQuorumNumeratoruint256

updateTimelock

Update the timelock address. Must be called via governance (address(this)).

function updateTimelock(address newTimelock) external;

Parameters

NameTypeDescription
newTimelockaddress

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

NameTypeDescription
proposalIduint256
proposeraddress
targetsaddress[]
valuesuint256[]
signaturesstring[]
calldatasbytes[]
voteStartuint256
voteEnduint256
descriptionstring

ProposalQueued

Emitted when a proposal is queued in the timelock.

event ProposalQueued(uint256 proposalId, uint256 etaSeconds);

Parameters

NameTypeDescription
proposalIduint256
etaSecondsuint256

ProposalExecuted

Emitted when a proposal is executed.

event ProposalExecuted(uint256 proposalId);

Parameters

NameTypeDescription
proposalIduint256

ProposalCanceled

Emitted when a proposal is canceled.

event ProposalCanceled(uint256 proposalId);

Parameters

NameTypeDescription
proposalIduint256

VoteCast

Emitted when a vote is cast (without extra params).

event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);

Parameters

NameTypeDescription
voteraddress
proposalIduint256
supportuint8
weightuint256
reasonstring

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

NameTypeDescription
voteraddress
proposalIduint256
supportuint8
weightuint256
reasonstring
paramsbytes

VotingDelaySet

Emitted when the voting delay is updated.

event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay);

Parameters

NameTypeDescription
oldVotingDelayuint256
newVotingDelayuint256

VotingPeriodSet

Emitted when the voting period is updated.

event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod);

Parameters

NameTypeDescription
oldVotingPerioduint256
newVotingPerioduint256

ProposalThresholdSet

Emitted when the proposal threshold is updated.

event ProposalThresholdSet(uint256 oldProposalThreshold, uint256 newProposalThreshold);

Parameters

NameTypeDescription
oldProposalThresholduint256
newProposalThresholduint256

QuorumNumeratorUpdated

Emitted when the quorum numerator is updated.

event QuorumNumeratorUpdated(uint256 oldNumerator, uint256 newNumerator);

Parameters

NameTypeDescription
oldNumeratoruint256
newNumeratoruint256

TimelockChange

Emitted when the timelock controller address is updated.

event TimelockChange(address indexed oldTimelock, address indexed newTimelock);

Parameters

NameTypeDescription
oldTimelockaddress
newTimelockaddress

Errors

GovernorAlreadyCastVote

Thrown when a voter has already cast a vote on a proposal.

error GovernorAlreadyCastVote(address voter);

Parameters

NameTypeDescription
voteraddress

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

NameTypeDescription
accountaddress

GovernorNonexistentProposal

Thrown when a proposal does not exist.

error GovernorNonexistentProposal(uint256 proposalId);

Parameters

NameTypeDescription
proposalIduint256

GovernorUnexpectedProposalState

Thrown when a proposal is in an unexpected state for the requested action.

error GovernorUnexpectedProposalState(uint256 proposalId, ProposalState current, bytes32 expectedStates);

Parameters

NameTypeDescription
proposalIduint256
currentProposalState
expectedStatesbytes32

GovernorInvalidVotingPeriod

Thrown when the voting period is zero or otherwise invalid.

error GovernorInvalidVotingPeriod(uint256 votingPeriod);

Parameters

NameTypeDescription
votingPerioduint256

GovernorInsufficientProposerVotes

Thrown when the proposer lacks sufficient voting power.

error GovernorInsufficientProposerVotes(address proposer, uint256 votes, uint256 threshold);

Parameters

NameTypeDescription
proposeraddress
votesuint256
thresholduint256

GovernorInvalidProposalLength

Thrown when proposal arrays (targets, calldatas, values) have mismatched lengths.

error GovernorInvalidProposalLength(uint256 targets, uint256 calldatas, uint256 values);

Parameters

NameTypeDescription
targetsuint256
calldatasuint256
valuesuint256

GovernorAlreadyQueuedProposal

Thrown when a proposal is already queued in the timelock.

error GovernorAlreadyQueuedProposal(uint256 proposalId);

Parameters

NameTypeDescription
proposalIduint256

GovernorNotQueuedProposal

Thrown when a proposal is not queued but execution expects it to be.

error GovernorNotQueuedProposal(uint256 proposalId);

Parameters

NameTypeDescription
proposalIduint256

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

NameTypeDescription
quorumNumeratoruint256
quorumDenominatoruint256

GovernorInvalidSignature

Thrown when an EIP-712 signature is invalid for the expected voter.

error GovernorInvalidSignature(address voter);

Parameters

NameTypeDescription
voteraddress

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

NameDescription
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

NameDescription
Against
For
Abstain