Implements single and multi-token rewards pools with continuous rewards
Any questions? Please contact us on Discord or read our Developer Guides for more information.
Allows users to deposit, withdraw, claim, and withdrawAndClaim from the single-token reward pools
Used to Deploy single-token rewards pools
Allows Owner to set reward source address and reward rates per second
Allows users to deposit, withdraw, claim, and withdrawAndClaim from the multi-token reward pools
Used to Deploy multi-token rewards pools
Allows Owner to approve new reward tokens, set the reward source address and reward rates per second
Overview
Check out more detailed smart contract Slither graphs with all the dependencies: YieldFarm-Continuous Slither Graphs.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# Restart terminal and/or run commands given at the end of the installation script
nvm install 12
nvm use 12
git clone https://github.com/BarnBridge/BarnBridge-DAO.git
cd BarnBridge-YieldFarming
Create an API key with a Provider such as Infura to deploy to Ethereum Public Testnet. In this guide, we are using Kovan.
- Navigate to Infura.io and create an account
- Log in and select "Get started and create your first project to access the Ethereum network"
- Create a project and name it appropriately; switch the Network to Kovan
- Copy the URL from the settings page and paste it into the section labeled PROVIDER in the .env file
- Navigate to EtherScan and create an account
- Log in and navigate to MyAPIKey
- Use the Add button to create an API key, and paste it into the section labeled ETHERSCAN in the .env file
- Finally, insert the mnemonic phrase for your testing wallet. You can use a MetaMask instance, and switch the network to Kovan on the upper right. DO NOT USE YOUR PERSONAL METAMASK SEED PHRASE; USE A DIFFERENT BROWSER WITH AN INDEPENDENT METAMASK INSTALLATION
- You'll need some Kovan-ETH (it is free) in order to pay the gas costs of deploying the contracts on the TestNet; you can use your GitHub account to authenticate to the KovanFaucet and receive 2 Kovan-ETH for free every 24 hours
npm install
npm run compile
npm run test
Note: The result of tests is readily available here.
npm run coverage
npm run deploy-from-env
With the addresses given by the previous deployment, you can use the calculate-next-address.ts, calculate-rate.ts, and query-contracts.ts scripts to gather data, and use the setup.ts script to update parameters.
PoolFactory deployed at: 0x2e93403C675Ccb9C564edf2dC6001233d0650582
SY cUSDC pool deployed at: 0x68af34129755091e22f91899ceac48657e5a5062
Severity: low
After a pool has exhausted its allowance on the rewardSource
, it will not attempt to pull any more tokens.
The problem with the above is that lastSoftPullTs
is not updated anymore due to 0 allowance.
If, at a later time, the pool is given more allowance on the rewardSource
, it will calculate the amount to pull as if it was never stopped which will trigger it to pull tokens for the whole period it was paused at the same rate.
The following actions would act as a workaround for the above issue:
- set the allowance to a very small number like
1
- trigger a
softPullReward()
-- this would effectively pull only the allowance given and update thelastSoftPullTs
- set the allowance to the desired value
For any concerns with the platform, open an issue on GitHub or visit us on Discord to discuss. For security concerns, please email [email protected].
Copyright 2021 BarnBridge DAO