Allows governors to vote on the weekly distribution of
MTArewards. Rewards are distributed between
n"Dials" proportionately to the % of votes the dial receives.
Vote weight derives from multiple whitelisted "Staking contracts". Voters can distribute their vote across (0 <= n <= 16 dials), at 0.5% increments in voting weight.
Once their preferences are cast, each time their voting weight changes it is reflected here through a hook.
The staking contracts are capped at 10% of the weekly distribution.
Contracts are upgradable.
function getVotes (address account) public returns (uint256 votingPower)
Gets the users aggregate voting power across all voting contracts.
Voting power can be from staking or it could be delegated to the account.
function topLineEmission (uint32 epoch) public returns (uint256 emissionForEpoch)
Calculates top line distribution amount for the current epoch as per the polynomial
Values are effectively scaled to 1e12 to avoid integer overflow on pow.
function getDialRecipient (uint256 dialId) public returns (address recipient)
Gets a dial's recipient address.
function getDialVoteHistory (uint256 dialId) public returns (struct HistoricVotes voteHistory)
Gets a dial's weighted votes for each distribution period.
function getDialVotes () public returns (uint256 dialVotes)
Gets the latest weighted votes for each dial. This will include disabled dials and their current weighted votes.
function getVoterPreferences (address voter) public returns (struct Preference preferences)
Gets a voter's weights for each dial.
A dial identifier of 255 marks the end of the array. It should be ignored.
function addDial (address _recipient, uint8 _cap, bool _notify) external
Adds a new dial that can be voted on to receive weekly rewards. Callable by system governor.
function updateDial (uint256 _dialId, bool _disabled, bool _notify) external
Updates a dials recipient contract and/or disabled flag.
function addStakingContract (address _stakingContract) external
Adds a new contract to the list of approved staking contracts.
function donate (uint256 _dialIds, uint256 _amounts) external
Allows arbitrary reward donation to a dial on top of the weekly rewards.
function calculateRewards () external
Calculates the rewards to be distributed to each dial for the next weekly period.
Callable once an epoch has fully passed. Top level emission for the epoch is distributed proportionately to vote count with the following exceptions: - Disabled dials are ignored and votes not counted. - Dials with a cap are capped and their votes/emission removed (effectively redistributing rewards).
function distributeRewards (uint256 _dialIds) external
Transfers all accrued rewards to dials and notifies them of the amount.
function pokeSources (address _voter) public
Re-cast a voters votes by retrieving balance across all staking contracts and updating
This would need to be called if a staking contract was added to the emissions controller when a voter already had voting power in the new staking contract and they had already set voting preferences.
function setVoterDialWeights (struct Preference _preferences) external
Allows a staker to cast their voting power across a number of dials.
A staker can proportion their voting power even if they currently have zero voting power. For example, they have delegated their votes. When they do have voting power (e.g. they undelegate), their set weights will proportion their voting power.
function moveVotingPowerHook (address from, address to, uint256 amount) external
Called by the staking contracts when a staker has modified voting power.
This can be called when staking, cooling down for withdraw or delegating.