Why
ERC4626 (tokenized vault) is the #2 DeFi primitive after AMMs. Share-based accounting (deposit assets → mint shares, burn shares → withdraw assets) is used in lending protocols, yield aggregators, and staking contracts. Key properties:
- Share/asset exchange rate monotonicity
- Rounding correctness (no value leakage from rounding)
- Deposit/withdraw roundtrip bounds
This would complement the AMM example by demonstrating ratio-based arithmetic proofs.
Scope
Minimal vault with:
deposit(assets) → mint shares proportional to assets/totalAssets
withdraw(shares) → burn shares, return proportional assets
totalAssets() / totalSupply() view functions
Key properties:
- Share price monotonicity: share price never decreases (absent external losses)
- Roundtrip bounds:
withdraw(deposit(x)) returns at least x - 1 (rounding loss bounded)
- Conservation: totalAssets = sum of all depositor claims
- No inflation attack: prove first-depositor advantage is bounded (or mitigated by virtual shares)
Effort
2-3 weeks
Acceptance
- Vault contract defined with specs
- Core properties proven with zero sorry
- Differential tests passing
Why
ERC4626 (tokenized vault) is the #2 DeFi primitive after AMMs. Share-based accounting (deposit assets → mint shares, burn shares → withdraw assets) is used in lending protocols, yield aggregators, and staking contracts. Key properties:
This would complement the AMM example by demonstrating ratio-based arithmetic proofs.
Scope
Minimal vault with:
deposit(assets)→ mint shares proportional to assets/totalAssetswithdraw(shares)→ burn shares, return proportional assetstotalAssets()/totalSupply()view functionsKey properties:
withdraw(deposit(x))returns at leastx - 1(rounding loss bounded)Effort
2-3 weeks
Acceptance