Internal Functions

The EGL Voting contract contains multiple internal functions. These include:


function _internalVote(
    address _voter,
    uint _gasTarget,
    uint _eglAmount,
    uint8 _lockupDuration,
    uint _releaseTime
) internal

Records the details of the vote for a given address and sets up the relevant data structures

Emits Vote event


function _internalWithdraw(
    address _voter
) internal returns (uint totalWithdrawn)

Removes the vote for a given address and calculates any rewards due

Emits Withdraw event


function _issueCreatorRewards(int _rewardEpoch) internal

Calculates the creator rewards for the reward epoch and transfers the rewards to the creatorRewardsAddress

Emits CreatorRewardsClaimed event


function _calculateBlockReward(
    int _blockGasLimit, 
    int _desiredEgl, 
    int _tallyVotesGasLimit
) internal returns (uint blockReward)

Calculates the potential block reward of the block that would be claimed by the miner of the block.

Emits BlockRewardCalculated event


function _calculateSerializedEgl(
    uint _timeSinceOrigin, 
    uint _maxEglSupply, 
    uint _timeLocked
) internal returns (uint serializedEgl)

Calculates the current serialized EGL. The serialized EGL value is used when calculating how many BPT's have been release as well as in the calculation of creator rewards

Emits SerializedEglCalculated event


function _calculateCurrentPoolTokensDue(
    uint _currentEgl, 
    uint _firstEgl, 
    uint _lastEgl, 
    uint _totalPoolTokens
) internal pure returns (uint poolTokensDue) 

Calculates the number of pool tokens due based on the current serialized EGL


function _calculateBonusEglsDue(
    uint _firstEgl, 
    uint _lastEgl
) internal pure returns (uint bonusEglsDue)  

Calculates the number of bonus EGL's due to Genesis participants based on their contribution in Genesis


function _calculateVoterReward(
    address _voter,
    uint16 _currentEpoch,
    uint16 _voterEpoch,
    uint8 _lockupDuration,
    uint _voteWeight
) internal returns(uint rewardsDue) 

Calculates the reward due to the voter based on their vote parameters

Emits VoterRewardCalculated event


function _calculatePercentageOfTokensInCirculation(
    uint _total
) internal view returns (uint votePercentage) 

Calculates the percentage of token in circulation give the total number of tokens

Last updated