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

Libraries

Inheritance Graph

graph TD RewardsDistribution[RewardsDistribution] --> Owned[Owned]

Structs

DistributionData

Source

Stores an address and a quantity of the inflationary tokens to send to it.

Fields

Field Type Description
destination address The address to send a portion of the inflationary supply to.
amount uint256 The quantity of tokens to send.

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

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

Visibility

public

State Mutability

nonpayable

Views

distributionsLength

Source

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

Details

Signature

distributionsLength() 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

nonpayable

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

nonpayable

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

nonpayable

Requires

Modifiers

setAuthority

Source

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

Details

Signature

setAuthority(address _authority)

Visibility

external

State Mutability

nonpayable

Modifiers

setFeePoolProxy

Source

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

Details

Signature

setFeePoolProxy(address _feePoolProxy)

Visibility

external

State Mutability

nonpayable

Modifiers

setRewardEscrow

Source

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

Details

Signature

setRewardEscrow(address _rewardEscrow)

Visibility

external

State Mutability

nonpayable

Modifiers

setSynthetixProxy

Source

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

Details

Signature

setSynthetixProxy(address _synthetixProxy)

Visibility

external

State Mutability

nonpayable

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

nonpayable

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)