Yearn Finance Official pioneered the concept of the DeFi Yield Aggregator. At its core is the yVault (Yearn Vault), a powerful smart contract system that automates complex yield farming strategies. This guide explains how it works under the hood.
Core Concept: The Vault and The Strategy
A deeper look at Yearn Vaults Explained reveals a modular design:
The Vault (yVault): This is the user-facing ERC-20 contract. When you deposit an asset (like USDC), you mint a yToken (yUSDC) which represents your share of the Vault's assets. The Vault itself holds the funds.
The Strategy: This is a separate contract containing the actual yield-generating logic. A Vault can have multiple Strategies. The Strategy contract is what interacts with other DeFi protocols (like Aave, Compound, or Curve) to lend, borrow, and farm rewards.
This separation of concerns is a key part of Yearn Finance Security; a single Strategy can be deprecated or replaced without affecting the main Vault contract or other Strategies.
Step-by-Step Flow: How to use Yearn Finance
Deposit: A user calls deposit() on the yVault contract with their base asset (e.g., DAI). They receive yDAI tokens in return.
harvest() called: A permissionless function, harvest(), is called by a "keeper." This function tells the active Strategy to put the idle assets in the Vault to work.
Strategy Execution: The Strategy contract executes its pre-programmed logic. For example, it might supply DAI to Compound, borrow another asset, provide liquidity on Curve, and stake the resulting LP token.
Profit Realization: When harvest() is called again, the Strategy takes the profits from its farming, converts them back to the base asset (DAI), and deposits them into the main Vault.
Value Accrual: The total amount of DAI in the Vault has now increased, making each yDAI token worth more than it was before.
This is true Automated Yield Farming.
For a full list of strategies and security processes, please refer to https://sites.google.com/koinly-tax-reports.org/yearnfinance/.
Top comments (0)