IVotes
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
| Name | Type | Description |
|---|---|---|
| account | address |
Returns
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| account | address | |
| timepoint | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getPastTotalSupply
Returns the total token supply checkpointed at timepoint (in the past).
function getPastTotalSupply(uint256 timepoint) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| timepoint | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
delegates
Returns the current delegate of account.
function delegates(address account) external view returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| account | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
delegate
Delegates votes from the caller to delegatee.
function delegate(address delegatee) external;Parameters
| Name | Type | Description |
|---|---|---|
| delegatee | address |
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
| Name | Type | Description |
|---|---|---|
| delegatee | address | |
| nonce | uint256 | |
| expiry | uint256 | |
| v | uint8 | |
| r | bytes32 | |
| s | bytes32 |
clock
Returns the current timepoint (block timestamp or block number).
function clock() external view returns (uint48);Returns
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| <none> | string |
Events
DelegateChanged
Emitted when an account changes its delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);Parameters
| Name | Type | Description |
|---|---|---|
| delegator | address | |
| fromDelegate | address | |
| toDelegate | address |
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
| Name | Type | Description |
|---|---|---|
| delegate | address | |
| previousVotes | uint256 | |
| newVotes | uint256 |
Errors
VotesExpiredSignature
The signature used for delegateBySig has expired.
error VotesExpiredSignature(uint256 expiry);Parameters
| Name | Type | Description |
|---|---|---|
| expiry | uint256 |
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
| Name | Type | Description |
|---|---|---|
| timepoint | uint256 | |
| clock | uint48 |
VotesOverflowedVotingUnits
A voting-units amount exceeded the uint208 checkpoint range.
error VotesOverflowedVotingUnits(uint256 value);Parameters
| Name | Type | Description |
|---|---|---|
| value | uint256 | The amount that could not be safely cast to uint208. |