Yearn Finance Integration
What is Yearn?
Yearn Finance offers automated DeFi strategies through vaults. Users deposit tokens, and Yearn's strategies automatically allocate across protocols based on algorithmic rules. Returns are variable and not guaranteed.
Like Morpho, Yearn vaults use the ERC-4626 standard, so the integration is relatively straightforward.
How NMT Integrates
| Layer | Component |
|---|---|
| Contract | YearnModule.sol — deposit, withdraw (ERC-4626 standard) |
| Backend | workers/src/defi/services/yearn/ — indexes vaults |
| Frontend | lib/defi/yearn/ — vault interaction encoding |
| Data source | yDaemon API (ydaemon.yearn.fi) |
Supported Chains
| Chain | Status |
|---|---|
| Ethereum | Active |
Operations
| Operation | What It Does |
|---|---|
| Deposit | Deposit tokens into a Yearn vault, receive vault shares |
| Withdraw | Burn vault shares, receive underlying tokens back |
Data Indexed
The backend fetches from Yearn's yDaemon API:
| Data Point | Purpose |
|---|---|
| Vault list | Available vaults and their underlying tokens |
| APY | Current and historical variable rates (not indicative of future performance) |
| TVL | Total value locked per vault |
| Strategy info | What the vault's strategy does |
Min TVL filter: $0 (all vaults indexed)
Data source: yDaemon is Yearn's official data API — free and open.
Update interval: Every 30 minutes