Skip to content
Lattice

IVotes

Git Source

Title: IVotes

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/utils/IVotes.sol)

Standard voting-power interface (ERC-5805 + ERC-6372).

Functions

getVotes

Returns the current voting power of account.

function getVotes(address account) external view returns (uint256);

Parameters

NameTypeDescription
accountaddress

Returns

NameTypeDescription
<none>uint256

getPastVotes

Returns the voting power of account at timepoint (in the past).

function getPastVotes(address account, uint256 timepoint) external view returns (uint256);

Parameters

NameTypeDescription
accountaddress
timepointuint256

Returns

NameTypeDescription
<none>uint256

getPastTotalSupply

Returns the total token supply checkpointed at timepoint (in the past).

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

Parameters

NameTypeDescription
timepointuint256

Returns

NameTypeDescription
<none>uint256

delegates

Returns the current delegate of account.

function delegates(address account) external view returns (address);

Parameters

NameTypeDescription
accountaddress

Returns

NameTypeDescription
<none>address

delegate

Delegates votes from the caller to delegatee.

function delegate(address delegatee) external;

Parameters

NameTypeDescription
delegateeaddress

delegateBySig

Delegates votes from the signer to delegatee via an EIP-712 signature.

function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;

Parameters

NameTypeDescription
delegateeaddress
nonceuint256
expiryuint256
vuint8
rbytes32
sbytes32

clock

Returns the current timepoint (block timestamp or block number).

function clock() external view returns (uint48);

Returns

NameTypeDescription
<none>uint48

CLOCK_MODE

Returns a machine-readable string describing the clock mode.

See ERC-6372 for defined values. Default is "mode=timestamp".

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

Returns

NameTypeDescription
<none>string

Events

DelegateChanged

Emitted when an account changes its delegate.

event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

Parameters

NameTypeDescription
delegatoraddress
fromDelegateaddress
toDelegateaddress

DelegateVotesChanged

Emitted when a token transfer or delegate change causes an account's voting weight to change.

event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes);

Parameters

NameTypeDescription
delegateaddress
previousVotesuint256
newVotesuint256

Errors

VotesExpiredSignature

The signature used for delegateBySig has expired.

error VotesExpiredSignature(uint256 expiry);

Parameters

NameTypeDescription
expiryuint256

ERC6372InconsistentClock

The clock was changed in an inconsistent manner.

error ERC6372InconsistentClock();

ERC5805FutureLookup

Attempted to look up a future timepoint.

error ERC5805FutureLookup(uint256 timepoint, uint48 clock);

Parameters

NameTypeDescription
timepointuint256
clockuint48

VotesOverflowedVotingUnits

A voting-units amount exceeded the uint208 checkpoint range.

error VotesOverflowedVotingUnits(uint256 value);

Parameters

NameTypeDescription
valueuint256The amount that could not be safely cast to uint208.