|Ethereum & Optimism
|Daniel Beal (@dbeal-eth), Leonardo Massazza (@leomassazza), Alejandro Santander (@ajsantander)
This SIP proposes a system for providing rewards (in addition to market performance) in Version 3 of the Synthetix protocol.
The proposed system allows pools to be connected to reward distributors by the pool’s owner using the rewards manager. This allows a token distribution to be provided across staking positions participating in the pool’s vaults (instantaneously or over time) pro-rata based on their amount of shares in the corresponding vault.
This system creates a generic interface for incentivizing users to deposit collateral into specific vaults, in addition to any credit delegated to pool participants via markets. The rewards manager may be used to implement inflationary rewards, create preferential fee structures for specific collateral types, and more.
First, a rewards distributor must be created, which will payout rewards to the main Synthetix proxy address. Then, a pool owner must register this rewards distributor to their pool with the rewards manager. Users may then see the quantity of rewards available to them and claim them through the rewards manager.
This system is appealing because it is very generic. This can essentially be used to create multiple instances of the original Staking Rewards contract functionality, and distribute multiple types of rewards on different schedules to users providing liquidity in specific ways. Technically, a payout could even entail a reward that isn't an ERC-20 token (such as non-transferrable 'points' in an external system). Note that this proposed system does not currently entail a mechanism for automatically depositing or locking rewarded tokens as collateral.
Reward distributors must conform to the IRewardDistributor interface. This only consists of
function payout(uint poolId, address token, address to, uint amount) external returns (bool);. When called, it should mint and/or transfer amount of token to the to address. For security reasons, this function should revert unless msg.sender is equal to Synthetix’s main proxy address.
A pool owner can then connect a rewards distributor to their pool with the
distributeRewards() function. The
collateralType parameters identify the relevant vault. The
index serves as an identifier for this distributor in relation to this vault.
distributor specifies the address of the contract which implements the
IRewardDistributor interface. amount indicates the total amount of tokens to be distributed starting at the start timestamp over duration seconds.
duration may be set to 0, such that the rewards are distributed instantaneously based on the pro-rata distribution at start. Also, this function can be called again for the pool owner or from the address of the relevant distributor to update the parameters.
Anyone can call the
getAvailableRewards() function to see what a particular account ID can claim from the distributors attached to a given vault. Then, an address than owns (or has relevant permissions on) that account can call the
claimRewards() function. This, in turn, calls the
payout() function on the rewards distributor with the appropriate amount.
Note that adding rewards distributors to a vault can increase gas usage for pool participants. Accordingly, only pool owners are allowed to add rewards distributors to the their vaults such that griefing attacks are preventable.
Relevant tests will be developed during implementation.
Copyright and related rights waived via CC0.