Welcome to Yearn Basics — a series breaking down everything you need to know about yearn.finance and its products.
dYdX, Aave, and Compound
Before throwing all of your money into Earn, it’s best to know what it’s using to generate yield. At the time of this writing, Earn interacts with the three lending protocols mentioned previously: dYdX, Aave, and Compound.
Aave is a non-custodial money market protocol where users can participate as depositors or borrowers. Depositors provide liquidity to the market to earn a passive income, while borrowers are able to borrow in an over collateralized (perpetually) or under collateralized (flash loan) fashion. It currently supports ETH and a wide range of ERC-20 tokens. Docs here.
Remember: By using Earn, you are a de facto user of any of these protocols at any given time. You’ll have to make your own decisions on whether or not you trust them and Earn.
Depositing into Earn
Each token pool supported by Earn is held in a separate smart contract. For example: All DAI is held in a yDAI contract, all USDC in a yUSDC contract, etc. The full list of Earn contracts is here—some have multiple versions, but as a user you don’t need to worry about this. You can find the deposit and claim interface for Earn here.
When you deposit into an Earn contract you’ll receive a ERC-20 token in return called a yToken (e.g. DAI → yDAI). This ERC-20 token represents your share of the overall liquidity in the Earn contract holding your deposit. In order to get your deposit back from the pool, you access the Earn interface and “claim” your yTokens — effectively burning them.
FAQ: Why is my yToken balance different from the total amount I deposited? That’s because your yToken is a share of an ever growing pool of liquidity. Don’t think of your yTokens as a 1:1 reflection of your deposit.
After receiving your yTokens you don’t need to do anything else. There’s more you can do with yTokens, but if you’re just looking to earn simple yield — you’re all set! You can track your deposits using the yearn.finance dashboard or with a service like zapper.fi/dashboard.
Inside an Earn Contract
Once you deposit your tokens into an Earn contract, the rest is automatic! No more chasing the best yields or actively managing your portfolio — Earn takes care of the dirty work.
To find the best APRs across the supported lending protocols, Earn contracts have a built in, on-chain “APR oracle.” The linked article is a bit outdated, but the principles are still the same. I also recommend reading this article and this article since they highlight how the APR calculations work in detail.
By grabbing yield data from each supported protocol, calculating APR, and comparing them — the contract can decide where to migrate users’ funds to get the best yield. Even better: It takes into consideration what the yield will be before withdrawing and migrating millions of dollars into a new protocol.
To validate this theory we can look at defiprime.com/defi-rates to find the highest APR across all lending platforms and then cross-check that data with stats.finance/yearn to see where yToken assets are parked:
Both confirm that Aave is the winner! Based.
yToken Curve Pools
Another place you might see mention of yTokens is on Curve — a same-peg asset exchange. Curve’s goal is to let users exchange stablecoins (incl. BTC tokens) with low fees and low slippage. It uses liquidity pools like Uniswap, so liquidity providers deposit tokens into a pool, receive LP tokens in return, and earn trading fees. Liquidity providers can stake these Curve LP tokens to earn CRV and other token rewards, but we’ll save that for another blog post.
curve.fi/y is made up of four tokens: yDAI, yUSDC, yUSDT, and yTUSD. What makes this pool — and the other pools using yTokens — special is that liquidity providers not only receive trading fees from the pool, but they also receive the best possible yields via Earn on their stablecoin deposits. Two birds, one stone! If you understand the curve.fi/y pool, the other pools are basically the same, so I’ll skip the explanation here.
Because of the added trading fees, yields on yToken Curve pools can trend higher than a simple Earn deposit depending on trade volume. If you’re looking to make use of those dormant yTokens and possibly earn some extra yield — consider tossing them into a Curve pool!
So you have some yTokens, deposited them into a yPool on Curve, and you’re sitting on some Curve liquidity tokens — now what? Fortunately for you the Yearn product suite doesn’t stop there! In the next edition of this series I’ll be covering yVaults.
If you have any questions or criticisms feel free to reach out to me.