A modified version of the Synthetix staking rewards contract, for use with Curve.fi liquidity gauges.
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:
-
The duration of the reward period is given as a constructor argument.
-
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.
- python3 version 3.6 or greater, python3-dev
- brownie - tested with version 1.12.0
- ganache-cli - tested with version 6.12.1
Prior to using these scripts you may wish to review the Brownie documentation on Account management.
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.
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.
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.
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.