Please read and be familiar with the Specification.
This repository is the set of smart contracts that are used for the Yearn Vaults. It contains the requirements, code, deployment scripts, and tests necessary for the core protocol, including a inheritable template strategy for use with Solidity-based strategies that interact with Yearn Vaults. These contracts are used to create a simple way to generate high risk-adjusted returns for depositors of various assets via best- in-class lending protocols, liquidity pools, and community-made yield farming strategies on Ethereum.
To run the project you need:
ETHERSCAN_TOKEN
, WEB3_INFURA_PROJECT_ID
).npm install -g ganache-cli@6.12.1
.To use the tools that this project provides, please pull the repository from GitHub and install its dependencies as follows. You will need yarn installed. It is recommended to use a Python virtual environment.
git clone https://github.com/yearn/yearn-vaults
cd yearn-vaults
yarn install --lock-file
Compile the Smart Contracts:
brownie compile # add `--size` to see contract compiled sizes
The below guide covers installation on Mac, Linux, Windows, and Windows using the Windows Subsystem for Linux.
Any command in code blocks
is meant to be executed from a Mac/Linux terminal or Windows command prompt.
python3 -m pip install --user pipx
python --version
, if it returns back something like Python 3.8.x
then just replace python3
with python
for all python commands in these instructionspython3 -m pipx ensurepath
pipx install eth-brownie
npm install -g ganache-cli@6.12.1
python3 -m pip install black
ETHERSCAN_TOKEN
environment variable to this key's value
setx ETHERSCAN_TOKEN yourtokenvalue
echo "export ETHERSCAN_TOKEN=\"yourtokenvalue\"" | sudo tee -a ~/.bash_profile
WEB3_INFURA_PROJECT_ID
environment variable to this key's value
setx WEB3_INFURA_PROJECT_ID yourtokenvalue
echo "export WEB3_INFURA_PROJECT_ID=\"yourtokenvalue\"" | sudo tee -a ~/.bash_profile
git clone https://github.com/yearn/yearn-vaults
cd yearn-vaults
yarn install --lock-file
--ignore-engines
(try this if you get an error)brownie compile
brownie test tests/functional/ -s -n auto
* If everything worked, you'll see something like the following:
code .
to launch VSCode
touch ~/.gitignore_global
.vscode/
to the ignore file
vi ~/.gitignore_global
.vscode/
and hit p
in vi:x
and hit entergit config --global core.excludesfile ~/.gitignore_global
git pull
to stay up to date with any changes made to the source codeIf you're not familiar with brownie, see the quickstart.
The fastest way to run the tests is:
brownie test tests/functional/ -n auto
Run tests with coverage and gas profiling:
brownie test tests/functional/ --coverage --gas -n auto
A brief explanation of flags:
-s
- provides iterative display of the tests being executed-n auto
- parallelize the tests, letting brownie choose the degree of parallelization--gas
- generates a gas profile report--coverage
- generates a test coverage reportCheck linter rules for *.json
and *.sol
files:
yarn lint:check
Fix linter errors for *.json
and *.sol
files:
yarn lint:fix
Check linter rules for *.py
files:
black . --check
Fix linter errors for *.py
files:
black .
For security concerns, please visit Bug Bounty.
You can read more about Yearn Finance on our documentation webpage.
For questions not covered in the docs, please visit our Discord server.