SIP 31: sETH LP rewards contract Source

AuthorClinton Ennis, Anton Bukov
Discussions-Tohttps://discord.gg/3uJ5rAy
StatusWIP
Created2019-11-04

Simple Summary

Replace the current uniswap sETH Liquidity Provider mechanism with an onchain LP rewards staking contract.

Abstract

Note: LP = Liquidity Provider

The current deployed solution is inefficient and buggy. There are weekly issues with valid LP’s not getting rewards and cheaters getting rewards that should be disqualified. This onchain solution fixes all the issues and can be automated and self serve requiring much less steps than the current solution.

Motivation

  • Current solution uses an off-chain python script to determine sETH Liquidity providers between two blocks which are manually entered.
  • We must download a CSV and manually verify the addresses and their LP amounts.
  • There are so many LPs now that it takes 2 multi-sig multi-send transactions to send out the LP SNX rewards.
  • The co-ordination amongst the 5 multi-sigs signers and overhead each manually verifying is inefficient given this could all be offloaded to a trusted smart contract to calculate on-chain in a trust-less manner.
  • The gnosis multi-sig freezes and is very slow to react since the payloads of the transactions are so big.
  • LP providers have noted is that if they withdraw / rebalance any amount of their liquidity from the pool during the week then all their rewards will be forfeited. The python script checks that no withdrawals / transfer of LP tokens have been made from the pool to prevent people from gaming the rewards.

Specification

Workflow

  1. User adds liquidity to sETH uniswap exchange and receives uniswap uni tokens
  2. User then stakes the uni tokens at unipool time staking contract
  3. Anyone can call Synthetix.mint() to mint the inflationary supply. This will then be sent to the RewardsDistribution contract where it will send an amount of tokens to the unipool contract. example transaction
  4. LP stakers will be assigned their % amount of SNX rewards based on their % of staked uni tokens against the pool of LP providers.
  5. LP stakers will need to come to the uni pool contract to claim their SNX rewards weekly.

Rationale

This onchain self service model is precicsly the use case for smart contracts and should replace the offchain rewards process eradicating the need for the;

The greatest disadvantage to LP’s is that they are current automatically sent their SNX. This model will require each LP to withdraw their SNX.

Test Cases

https://github.com/k06a/Unipool/blob/master/test/Unipool.js

Implementation

The proposed implementation https://github.com/k06a/Unipool

Copyright and related rights waived via CC0.