Smart-contracts that implements rewarding management for 1inch liquidity pool (a part of co-incentivization).
Deployment, initalization and usage flows are described in separate FLOW document.
Contract follows principles from other repositories: lidofinance/staking-rewards-manager, lidofinance/balancer-rewards-manager and lidofinance/staking-rewards-sushi.
Following parts are adapted for compatibility with 1inch liquidity protocol FarmingRewards
contract:
- Added
GIFT_INDEX
constant. This is due toFarmingRewards
contract requires manager contract to be aware of gift index (value dependends on order ofaddGift()
call). - Method
_period_finish()
adapted to obtain data fromFarmingRewards.TokenRewards
structure, that stores referenced reward data inFarmingRewards.tokenRewards
state variable (of array type). - Method
start_next_rewards_period()
adapted to transfer reward tokens toFarmingRewards
instance address and triggerFarmingRewards.notifyRewardAmount()
method. Key points:FarmingRewards.notifyRewardAmount()
requires tokens to be already transfered toFarmingRewards
instance address.- Tokens are unable to be recovered after the operation.
To use the tools provided by this project, please pull the repository from GitHub and install its dependencies as follows. It is recommended to use a Python virtual environment.
npm install
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements-dev.txt
Compile the smart contracts:
brownie compile # add `--size` to see contract compiled sizes
To test on mainnet fork you neet to set your Infura project ID first:
export WEB3_INFURA_PROJECT_ID=YourProjectID
Run tests only:
brownie test
Run tests with evaluating coverage and gas usage:
brownie test --coverage --gas -v