Found Academy useful? A $5 donation by May 14 helps us ship more, faster. Every donor counts (QF matching).

Donate
Medium
engineering

Building Yearn V2

Build the most-forked vault aggregator in DeFi from scratch. Multi-strategy yield allocation, dynamic debt rebalancing, locked profit degradation, first-depositor and donation defenses, and the harvest cycle that turns strategy gains into share-price growth. Every function, every invariant. Modernized to Solidity 0.8.x.

What you are building

You will write the actual Yearn V2 vault and BaseStrategy: VaultStorage, VaultShareToken with EIP-2612 permit, share math with first-depositor and donation defenses, the strategy registry and credit/debt allocation, the report cycle, locked profit degradation, the multi-strategy withdraw queue, fees paid via share dilution, emergency shutdown, and the harvest cycle on the strategy side. Two inheritance chains, eighteen sections, modernized to Solidity 0.8.x.

License: AGPL-3.0Source: yearn/yearn-vaultsSolidity: ^0.8.20
18 sections
Lynx400 Lynx
~420 min