IVotesUpgradeable
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
Name | Type | Description |
---|---|---|
delegatee | address | undefined |
delegateBySig
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external nonpayable
Delegates votes from signer to delegatee
.
Parameters
Name | Type | Description |
---|---|---|
delegatee | address | undefined |
nonce | uint256 | undefined |
expiry | uint256 | undefined |
v | uint8 | undefined |
r | bytes32 | undefined |
s | bytes32 | undefined |
delegates
function delegates(address account) external view returns (address)
Returns the delegate that account
has chosen.
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | address | undefined |
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
Name | Type | Description |
---|---|---|
blockNumber | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
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
Name | Type | Description |
---|---|---|
account | address | undefined |
blockNumber | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
getVotes
function getVotes(address account) external view returns (uint256)
Returns the current amount of votes that account
has.
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
Events
DelegateChanged
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate)
Emitted when an account changes their delegate.
Parameters
Name | Type | Description |
---|---|---|
delegator indexed | address | undefined |
fromDelegate indexed | address | undefined |
toDelegate indexed | address | undefined |
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
Name | Type | Description |
---|---|---|
delegate indexed | address | undefined |
previousBalance | uint256 | undefined |
newBalance | uint256 | undefined |