Skip to content

RewardsDistribution

Description

This contract distributes the inflationary supply rewards after they have been minted. The primary recipient remains the population of SNX stakers, but new ones can be added to receive an allocation of tokens first. These entries can then be modified or removed.

The actual quantity of tokens to inject into the supply each week is passed into distributeRewards by Synthetix.mint; how much the quantity is on any given week is determined by the SupplySchedule contract.

Incentivising activities other than staking was first trialed with UniSwap, which was then formalised into SIP-8, resulting in this contract.

Source: contracts/RewardsDistribution.sol

Architecture

Variables

authority

Source

The address authorised to call distributeRewards, which is used only by Synthetix.mint.

Type: address

distributions

Source

An array of distribution recipients and the amount of SNX each will receive from the weekly inflationary supply.

Type: struct IRewardsDistribution.DistributionData[]

feePoolProxy

Source

The address of the FeePool Proxy, which has to be informed how many rewards it has left to distribute once distributions have been made.

Type: address

rewardEscrow

Source

The address of the RewardEscrow, where all remaining tokens are sent once other distributions have been made.

Type: address

synthetixProxy

Source

The address of the Synthetix ProxyERC20 for transferring SNX to distribution recipients and the RewardEscrow contract.

Type: address

Constructor

constructor

Source

Initialises the addresses of various related contracts, as well as the inherited Owned instance.

Details

Signature

constructor(address _owner, address _authority, address _synthetixProxy, address _rewardEscrow, address _feePoolProxy)

Visibility

public

State Mutability

``

Views

distributionsLength

Source

The number of recipients receiving distributions. This is an alias for distributions.length.

Details

Signature

distributionsLength() view returns (uint256)

Visibility

external

State Mutability

view

Restricted Functions

addRewardDistribution

Source

Allows the owner to add new reward distribution recipients.

This function always returns true if it does not revert.

Details

Signature

addRewardDistribution(address destination, uint256 amount) returns (bool)

Visibility

external

State Mutability

``

Requires

Modifiers

Emits

editRewardDistribution

Source

Modifies a distribution recipient or the quantity to be released to them in the distributions list at the specified index.

This function always returns true if it does not revert.

Details

Signature

editRewardDistribution(uint256 index, address destination, uint256 amount) returns (bool)

Visibility

external

State Mutability

``

Requires

Modifiers

removeRewardDistribution

Source

Removes a distribution recipient from the distributions list at the specified index.

Details

Signature

removeRewardDistribution(uint256 index)

Visibility

external

State Mutability

``

Requires

Modifiers

setAuthority

Source

Allows the owner to set the address of the fee authority.

Details

Signature

setAuthority(address _authority)

Visibility

external

State Mutability

``

Modifiers

setFeePoolProxy

Source

Allows the owner to set the address of the FeePool Proxy.

Details

Signature

setFeePoolProxy(address _feePoolProxy)

Visibility

external

State Mutability

``

Modifiers

setRewardEscrow

Source

Allows the owner to set the address of the RewardEscrow contract.

Details

Signature

setRewardEscrow(address _rewardEscrow)

Visibility

external

State Mutability

``

Modifiers

setSynthetixProxy

Source

Allows the owner to set the address of the Synthetix ProxyERC20.

Details

Signature

setSynthetixProxy(address _synthetixProxy)

Visibility

external

State Mutability

``

Modifiers

External Functions

distributeRewards

Source

Distributes a quantity of new SNX among stakers and other reward recipients as part of supply inflation.

First, for each element d in the distributions list, d.amount SNX is sent to d.destination. The remaining tokens are then transferred to the RewardEscrow contract to be claimed by stakers, and the FeePool is notified of the updated claimable supply.

This function always returns true if it does not revert.

Sufficient SNX Balance

There will always be sufficient SNX in the RewardsDistribution contract to support this operation, since its SNX balance is directly credited the correct number of tokens by Synthetix.mint immediately before the only call to this function. Only the Synthetix contract is authorised to execute rewards distribution, and this is the only place new SNX finds its way into the system.

Details

Signature

distributeRewards(uint256 amount) returns (bool)

Visibility

external

State Mutability

``

Requires

Emits

Events

RewardDistributionAdded

Source

Records that a new recipient was added to the distributions list, and the index they were added at.

Signature: RewardDistributionAdded(uint256 index, address destination, uint256 amount)

RewardsDistributed

Source

Records that a quantity of the inflationary rewards have been dispersed among the distributions recipients and the pool of stakers.

Signature: RewardsDistributed(uint256 amount)