Skip to main content

IVotes

Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. Available since v4.5.

Methods

delegate

function delegate(address delegatee) external nonpayable

Delegates votes from the sender to delegatee.

Parameters

NameTypeDescription
delegateeaddressundefined

delegateBySig

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

Delegates votes from signer to delegatee.

Parameters

NameTypeDescription
delegateeaddressundefined
nonceuint256undefined
expiryuint256undefined
vuint8undefined
rbytes32undefined
sbytes32undefined

delegates

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

Returns the delegate that account has chosen.

Parameters

NameTypeDescription
accountaddressundefined

Returns

NameTypeDescription
_0addressundefined

getPastTotalSupply

function getPastTotalSupply(uint256 blockNumber) external view returns (uint256)

Returns the total supply of votes available at the end of a past block (blockNumber). NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. Votes that have not been delegated are still part of total supply, even though they would not participate in a vote.

Parameters

NameTypeDescription
blockNumberuint256undefined

Returns

NameTypeDescription
_0uint256undefined

getPastVotes

function getPastVotes(address account, uint256 blockNumber) external view returns (uint256)

Returns the amount of votes that account had at the end of a past block (blockNumber).

Parameters

NameTypeDescription
accountaddressundefined
blockNumberuint256undefined

Returns

NameTypeDescription
_0uint256undefined

getVotes

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

Returns the current amount of votes that account has.

Parameters

NameTypeDescription
accountaddressundefined

Returns

NameTypeDescription
_0uint256undefined

Events

DelegateChanged

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

Emitted when an account changes their delegate.

Parameters

NameTypeDescription
delegator indexedaddressundefined
fromDelegate indexedaddressundefined
toDelegate indexedaddressundefined

DelegateVotesChanged

event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance)

Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.

Parameters

NameTypeDescription
delegate indexedaddressundefined
previousBalanceuint256undefined
newBalanceuint256undefined