Saffron Staking V2

Saffron staking

This is an implementation of the Saffron V2 ERC20 staking contract, which is forked from Sushiswap's Masterchef contract.
The intention is to use it to incentivize the following pools:
  1. 1.
    SFI single-asset staking
  2. 2.
    SFI/ETH Uniswap V2 pool
  3. 3.
    SFI/ETH Sushiswap pool
Governance controls the amount of SFI to be added to and distributed by this contract. This contract has an end-of-life because SFI is hard capped at 100,000 total supply. It will be replaced with another contract (determined by governance) to reward staking in the absence of SFI emissions.

Implementation Details

SFI Rewarder

SFIRewarder holds SFI tokens to be used to distribute rewards to users. It separates users' deposits of SFI tokens and rewards into separate pools. This is an extension on the typical Masterchef contract that separates concerns because of the single-asset SFI staking option.

SaffronStakingV2

SaffronStakingV2 holds rewarded ERC20 tokens and manages the reward payout for each user in the pool. This is forked directly from Sushiswap's Masterchef with the addition of SFIRewarder to clearly distinguish between SFI held by users and SFI to be rewarded based on emissions.

Development

  1. 1.
    Install the dependencies.
npm install
  1. 1.
    Create .env file in your root directory.
ETHERSCAN_APIKEY=YOUR ETHERSCAN API KEY
PRIVATEKEY=YOUR PRIVATE KEY
INFURA_KEY=YOUR INFURA KEY
COINMARKETCAP=YOUR COINMARKETCAP API KEY
  1. 1.
    To compile the contracts, use this command.
npm run compile

Deploy

To deploy the contracts to mainnet, use this command.
npm run deploy:mainnet
To deploy the contracts to ropsten, use this command.
npm run deploy:ropsten

Test

To test the contracts, use this command.
npm run test

Code Coverage

For a code coverage report, use this command.
npx hardhat coverage
Coverage report is output on terminal and an HTML coverage report is generated in coverage/index.html

Notes

You can use the testHelper library to add more unit tests.
Copy link
On this page
Saffron staking
Implementation Details
Development
Deploy
Test
Code Coverage
Notes