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()
Allows any wallet with EGL's to submit a vote to affect the weekly desired gas limit value
Function Signature
function vote(uint _gasTarget, uint _eglAmount, uint8 _lockupDuration) external whenNotPausedParameters
Data Type
Description
Example
_gasTarget
uint256
The gas limit value you are voting for (must be + / - 4,000,000 of the current blocks gas limit)
16500000
_eglAmount
uint256
The amount of EGLs to be locked and used for voting (Must be >=1 EGL)
10000000000000000000
_lockupDuration
uint8
The number of weeks your vote will be locked up for (valid values are numbers 1 through 8)
6
Validations
Validation Rule
Description
_eglAmount >= 1 ether
Amount being voted with must be greater than 10000000000000000000 (1 EGL)
_eglAmount <= eglToken.balanceOf(msg.sender)
The voting address must have a balance that is at least equal to the amount being voted with
eglToken.allowance(msg.sender, address(this)) >= _eglAmount
The voting contract must a have an allowance from the voter of at least the voting amount
Events Emitted
VotesTallied(Conditional)TransferVote
Web3 Example
2. 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.
Parameters
Data Type
Description
Example
_gasTarget
uint256
The gas limit value you are voting for (must be + / - 4,000,000 of the current gas limit)
16500000
_eglAmount
uint256
The amount of EGLs, over and above the original vote, to be locked and used for voting (Can be 0)
0
_lockupDuration
uint8
The number of weeks your vote will be locked up for (valid values are numbers 1 through 8)
6
Validations
Validation Rule
Description
voters[msg.sender].tokensLocked > 0
Voting address must already have a vote locked to use reVote()
_eglAmount >= 1 ether
If _eglAmount > 0, the amount being voted with must be greater than 10000000000000000000 (1 EGL)
_eglAmount <= eglToken.balanceOf(msg.sender)
if If _eglAmount > 0, the voting address must have a balance that is at least equal to the amount being voted with
eglToken.allowance(msg.sender, address(this)) >= _eglAmount
If _eglAmount > 0, the voting contract must a have an allowance from the voter of at least the voting amount
Events Emitted
VotesTallied(Conditional)Transfer(Conditional)WithdrawVoteReVote
Web3 Example
Last updated