Voting
Public Functions
There are 2 functions that support voting -
vote
- used when the wallet/address has no active vote nor EGLs locked or uncollectedreVote
- used to either change an existing votes parameters (gas target, lockup duration and/or number of EGL's voted with), or to submit a new vote if the existing vote has elapsed (exceeded the lockup duration) without first withdrawing the EGLs to a wallet address
See Voting for more details
1.vote()
vote()
Allows any wallet with EGL's to submit a vote to affect the weekly desired gas limit value
Since any vote requires you to spend some amount of EGL's, it is necessary to ensure the voting contract has a sufficient allowance
to spend that amount of EGL's for the vote on your behalf. If the allowance is set high enough, this only had to be done once
The _eglAmount
parameter must be passed in as the wei value, i.e. the EGL token uses 18 decimal places so 1 EGL = 1000000000000000000 wei
This function will additionally call tallyVotes()
if the current voting period (epoch) has elapsed and the vote for the previous period has not yet been tallied. See Tally Votes
Function Signature
Parameters | Data Type | Description | Example |
|
| The gas limit value you are voting for (must be + / - 4,000,000 of the current blocks gas limit) | 16500000 |
|
| The amount of EGLs to be locked and used for voting (Must be >=1 EGL) | 10000000000000000000 |
|
| The number of weeks your vote will be locked up for (valid values are numbers 1 through 8) | 6 |
Validations
Validation Rule | Description |
| Amount being voted with must be greater than 10000000000000000000 (1 EGL) |
| The voting address must have a balance that is at least equal to the amount being voted with |
| The voting contract must a have an allowance from the voter of at least the voting amount |
Events Emitted
VotesTallied
(Conditional)Transfer
Vote
Web3 Example
2. reVote()
reVote()
Allows a wallet that already has a vote locked in, to update that existing vote. This function also calculates any rewards that are due to the voter from past weeks (epochs). These rewards are automatically added to the updated vote. It is also possible, but not required, to add additional EGL's to the vote over and above the original vote amount.
Updating a vote with a shorter _lockupDuration
will not allow locked EGL's to be released sooner. For example, if a vote was entered with an original _lockupDuration
of 6 weeks, and 1 week later a reVote()
was entered with a new lockup duration of 2 weeks, the EGL's will still only be unlocked 6 weeks from the original vote date, i.e. the unlock/release date is set to themax(originalLockupDuration, reVoteLockupDuration)
If an additional amount of EGL's is being voted with, over and above the original amount, it is necessary to ensure the voting contract has a sufficient allowance to spend the required amount of EGL's for the vote from your account.
The _eglAmount
parameter must be passed in as the wei value, i.e. the EGL token uses 18 decimal places so 1 EGL = 1000000000000000000 wei
This function will additionally call tallyVotes()
if the current voting period (epoch) has elapsed and the vote for the previous period has not yet been tallied. See Tally Votes
Parameters | Data Type | Description | Example |
|
| The gas limit value you are voting for (must be + / - 4,000,000 of the current gas limit) | 16500000 |
|
| The amount of EGLs, over and above the original vote, to be locked and used for voting (Can be 0) | 0 |
|
| The number of weeks your vote will be locked up for (valid values are numbers 1 through 8) | 6 |
Validations
Validation Rule | Description |
| Voting address must already have a vote locked to use |
| If |
| if If |
| If |
Events Emitted
VotesTallied
(Conditional)Transfer
(Conditional)Withdraw
Vote
ReVote
Web3 Example
Last updated