EmissionsController

Allows governors to vote on the weekly distribution of MTA rewards. 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.

Process

Functions

getVotes()

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.

ParameterTypeDescription

account

address

For which to fetch voting power.

topLineEmission()

function topLineEmission (uint32 epoch) public returns (uint256 emissionForEpoch)

Calculates top line distribution amount for the current epoch as per the polynomial (f(x)=A*(x/div)^3+B*(x/div)^2+C*(x/div)+D).

Values are effectively scaled to 1e12 to avoid integer overflow on pow.

ParameterTypeDescription

epoch

uint32

The number of weeks since 1 Jan 1970.

getDialRecipient()

function getDialRecipient (uint256 dialId) public returns (address recipient)

Gets a dial's recipient address.

ParameterTypeDescription

dialId

uint256

Dial identifier starting from 0.

getDialVoteHistory()

function getDialVoteHistory (uint256 dialId) public returns (struct HistoricVotes[] voteHistory)

Gets a dial's weighted votes for each distribution period.

ParameterTypeDescription

dialId

uint256

Dial identifier starting from 0.

getDialVotes()

function getDialVotes () public returns (uint256[] dialVotes)

Gets the latest weighted votes for each dial. This will include disabled dials and their current weighted votes.

getVoterPreferences()

function getVoterPreferences (address voter) public returns (struct Preference[16] preferences)

Gets a voter's weights for each dial.

A dial identifier of 255 marks the end of the array. It should be ignored.

ParameterTypeDescription

voter

address

Address of the voter that has set weights.

addDial()

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.

ParameterTypeDescription

_recipient

address

Address of the contract that will receive rewards.

_cap

uint8

Cap where 0 = uncapped and 10 = 10%.

_notify

bool

If true, notifyRewardAmount is called in the distributeRewards function.

updateDial()

function updateDial (uint256 _dialId, bool _disabled, bool _notify) external

Updates a dials recipient contract and/or disabled flag.

ParameterTypeDescription

_dialId

uint256

Dial identifier which is the index of the dials array.

_disabled

bool

If true, no rewards will be distributed to this dial.

_notify

bool

If true, notifyRewardAmount is called on the dial recipient contract.

addStakingContract()

function addStakingContract (address _stakingContract) external

Adds a new contract to the list of approved staking contracts.

ParameterTypeDescription

_stakingContract

address

Address of the new staking contract

function donate (uint256[] _dialIds, uint256[] _amounts) external

Allows arbitrary reward donation to a dial on top of the weekly rewards.

ParameterTypeDescription

_dialIds

uint256[]

Dial identifiers that will receive donated rewards.

_amounts

uint256[]

Units of rewards to be sent to each dial including decimals.

calculateRewards()

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).

distributeRewards()

function distributeRewards (uint256[] _dialIds) external

Transfers all accrued rewards to dials and notifies them of the amount.

ParameterTypeDescription

_dialIds

uint256[]

Dial identifiers for which to distribute rewards.

pokeSources()

function pokeSources (address _voter) public

Re-cast a voters votes by retrieving balance across all staking contracts and updating lastSourcePoke.

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.

ParameterTypeDescription

_voter

address

Address of the voter for which to re-cast.

setVoterDialWeights()

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.

ParameterTypeDescription

_preferences

struct Preference[]

Structs containing dialId & voting weights, with 0 <= n <= 16 entries.

moveVotingPowerHook()

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.
ParameterTypeDescription

from

address

Account that votes moved from. If a mint the account will be a zero address.

to

address

Account that votes moved to. If a burn the account will be a zero address.

amount

uint256

The number of votes moved including the decimal places.

Last updated