Skip to content

A modified version of the SNX staking rewards contract, for use with Curve.fi liquidity gauges.

License

Notifications You must be signed in to change notification settings

curvefi/unipool-fork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unipool-fork

A modified version of the Synthetix staking rewards contract, for use with Curve.fi liquidity gauges.

Overview

The StakingRewards contract in this repository is a flattened and modified version of the SNX staking rewards contract.

The following modifications were made, to simplify integration with Curve's reward liquidity gauge:

  1. The duration of the reward period is given as a constructor argument.

  2. Transferring additional reward tokens into the contract is handled via transferFrom. This ensures the reward amount is always correct, and reduces the number of transactions required to fund the contract.

Dependencies

Usage

Prior to using these scripts you may wish to review the Brownie documentation on Account management.

Deployment

To deploy the contract, edit the constant variables at the top of scripts/deploy.py. Then:

brownie run deploy --network mainnet

This script deploys StakingRewards, set the initial reward period to one day, and seeds it with a single token. Once this is finished, please provide the Curve team with the deployment address so that we can verify the integration within our gauge.

Updating Available Rewards

To update the available rewards, edit the constants at the top of scripts/update_rewards.py. Then:

brownie run update_rewards --network mainnet

The exact functionality of the script is documented via the comments within it.

You must run this script, or otherwise complete the actions within it, at the start of each new reward period. As such, we recommend 30 days as an optimal reward period duration.

Testing

To validate the outcome of a script prior to running on mainnet, we recommend a dry-run in a forked mainnet environment:

brownie run update_rewards --network mainnet-fork -I

This command runs the script in a forked mainnet, and loads an interactive console upon completion. Within the console you can interact with the contracts to verify the expected outcome.

Licence

The smart contract within this repository is forked from Synthetixio/synthetix which is licensed under the MIT license.

This repository is licensed under the MIT license.

About

A modified version of the SNX staking rewards contract, for use with Curve.fi liquidity gauges.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published