Shade Undertree
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Yearn Protocol [![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg)](https://github.com/iearn-finance/yearn-protocol/blob/master/LICENSE) ![Lint](https://github.com/iearn-finance/yearn-protocol/workflows/Lint/badge.svg) ![Test](https://github.com/iearn-finance/yearn-protocol/workflows/Test/badge.svg) Yearn Protocol is a set of Ethereum Smart Contracts focused on creating 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. Before getting started with this repo, please read: - [Andre's Overview Blog Post](https://medium.com/iearn/yearn-finance-v2-af2c6a6a3613), describing how yearn.finance works. - The [Delegated Vaults Blog Post](https://medium.com/iearn/delegated-vaults-explained-fa81f1c3fce2), explaining how the delegated vaults work. - [yETH Vault Explained](https://medium.com/iearn/yeth-vault-explained-c29d6b93a371), describing how the yETH vault works. ### Requirements To run the project you need: - Python 3.8 local development environment and Node.js 10.x development environment for Ganache. - Brownie local environment setup. See instructions: [ETH Brownie](https://github.com/eth-brownie/brownie). - Local env variables for [Etherscan API](https://etherscan.io/apis) and [Infura](https://infura.io/) (`ETHERSCAN_TOKEN`, `WEB3_INFURA_PROJECT_ID`). - Local Ganache environment installed with `npm install -g ganache-cli@6.11`. ### Installation To run the yearn protocol, pull the repository from GitHub and install its dependencies. You will need yarn installed. ```bash git clone https://github.com/iearn-finance/yearn-protocol cd yearn-protocol yarn install --lock-file ``` Compile the Smart Contracts: ```bash brownie compile ``` Note that you can run this project from Mac, Linux, Windows, or the Windows Subsystem for Linux. #### Extended Instructions 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. 0. *Note for Windows users:* if you want to use the Windows Subsystem for Linux (WSL), go ahead and [install it now](https://docs.microsoft.com/en-us/windows/wsl/install-win10). * After it's installed, launch the your chosen linux subsystem. * Follow the linux instructions below from within your terminal, except for VSCode. Any VSCode installation happens in Windows, not the linux subsystem. 1. Install [VSCode](https://code.visualstudio.com/docs/setup/setup-overview) 2. Install VSCode Extensions * [Solidity](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity ) * [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) * If you're using the WSL * Wait to install the Solidity Compiler, you'll do this in a later step. * Install [Remote - WSL](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) 3. Install [Python 3.8](https://www.python.org/downloads/release/python-380/) * Linux: Refer to your distro documentation * [Mac installer](https://www.python.org/ftp/python/3.8.0/python-3.8.0-macosx10.9.pkg) * [Windows installer](https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe) 4. [Setup Brownie](https://github.com/eth-brownie/brownie) * `python3 -m pip install --user pipx` * Note, if you get an error to the effect of python3 not being installed or recognized, run `python --version`, if it returns back something like `Python 3.8.x` then just replace `python3` with `python` for all python commands in these instructions. * `python3 -m pipx ensurepath` * `pipx install eth-brownie` * If you're on Windows (pure Windows, not WSL), you'll need to install the [C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) before executing this. 5. Install Node.js 10.x * Linux or Mac: via your [package manager](https://nodejs.org/en/download/package-manager/) * Windows: [x64 installer](https://nodejs.org/dist/latest-v10.x/node-v10.22.1-x64.msi) * Other [10.x downloads](https://nodejs.org/dist/latest-v10.x) 6. Install [Ganache](https://github.com/trufflesuite/ganache-cli) * `npm install -g ganache-cli@6.11` 7. [Install Yarn](https://classic.yarnpkg.com/en/docs/install) 8. [Install Black](https://pypi.org/project/black/) * `python3 -m pip install black` 9. Setup an account on [Etherscan](https://etherscan.io) and create an API key * Set `ETHERSCAN_TOKEN` environment variable to this key's value * Windows: `setx ETHERSCAN_TOKEN yourtokenvalue` * Mac/Linux: `echo "export ETHERSCAN_TOKEN=\"yourtokenvalue\"" | sudo tee -a ~/.bash_profile` 10. Setup an account on [Infura](https://infura.io) and create an API key * Set `WEB3_INFURA_PROJECT_ID` environment variable to this key's value * Windows: `setx WEB3_INFURA_PROJECT_ID yourtokenvalue` * Mac/Linux: `echo "export WEB3_INFURA_PROJECT_ID=\"yourtokenvalue\"" | sudo tee -a ~/.bash_profile` 11. Close & re-open your terminal before proceeding (to get the new environment variable values). 12. If you don't have git yet, go [set it up](docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/set-up-git). 13. Pull the repository from GitHub and install its dependencies. * `git clone https://github.com/iearn-finance/yearn-protocol` * `cd yearn-protocol` * `yarn install --lock-file` * You may have to install with `--ignore-engines` 14. Compile the Smart Contracts: * `brownie compile` 15. `brownie test -s` * Everthing should be green and say 'passed'. 16. Launch VSCode * If you're in Windows using WSL, type `code .` to launch VSCode * At this point install [Solidity Compiler](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity ) - be sure to *Install in WSL* * Open one of the .sol files, right click the code and click *Soldity: Change Workspace compiler version (Remote)*, Change to 0.5.17 * Alternatively, go to File -> Preferences -> Settings * If you’re using WSL, go to the Remote [WSL] tab. * Otherwise choose the Workspace tab * Search for *Solidity* and copy and paste *v0.5.17+commit.d19bba13* into the *Solidity: Compile Using Remote Version* textbox. * Set Black as the linter. * You'll see a toast notification the bottom right asking about linting, choose Black. * If you don't see this, just go to *File* -> *Preferences* -> *Settings* * If you're using WSL, go to the *Remote [WSL]* tab. * Otherwise choose the *Workspace* tab * Search for *python formatting provider* and choose *black*. * Search for *format on save* and check the box. 17. Lastly, you'll want to add .vscode to to your global .gitignore * Use a terminal on Mac / Linux, use Git Bash on Windows * `touch ~/.gitignore_global` * use your favorite editor and add `.vscode/` to the ignore file * `git config --global core.excludesfile ~/.gitignore_global` 18. Congratulations! You're all set up. * Use `git pull` to stay up to date with any changes made to the source code. * If you want to switch to the master branch, use `git checkout master`. By default you'll be in `develop`, which is where you can see the latest features getting ready for release. ### Tests If you're not familiar with brownie, see the [quickstart](https://eth-brownie.readthedocs.io/en/stable/quickstart.html). Tests are commented following the [NumPy docstring style](https://numpydoc.readthedocs.io/en/latest/format.html). [*Draft Note from Shade: This is not true yet but I'm working on adding comments right now, so we'll have them around the time this readme is checked in.* Run tests: [*Draft Note from Shade: There's a PR waiting that will change this to brownie test -s -n auto, which will parallelize the tests, this note is my reminder to update the docs once that PR goes through.*] ```bash brownie test -s ``` Run tests with coverage: ```bash brownie test -s --coverage ``` ### Formatting Check linter rules for `*.json` and `*.sol` files: ```bash yarn lint:check ``` Fix linter errors for `*.json` and `*.sol` files: ```bash yarn lint:fix ``` Check linter rules for `*.py` files: ```bash black . --check ``` Fix linter errors for `*.py` files: ```bash black . ``` ### Security For security concerns, please visit [Bug Bounty](https://github.com/iearn-finance/yearn-protocol/blob/develop/SECURITY.md). ### Documentation You can read more about yearn finance on our documentation [webpage](https://docs.yearn.finance). ### Discussion For questions not covered in the docs, please visit [our Discord server](http://discord.yearn.finance).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully