You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERC-4626 (Tokenized Vaults) is the most widely deployed yield-bearing primitive in DeFi after ERC-20 itself. It reached Final in 2022 and is now the integration surface for lending markets, yield aggregators, structured products, and RWA vaults across every major chain.
Traction signals:
760+ vault deployments cross-chain
Billions in TVL (Yearn, Aave, Maker, Morpho, Pendle, and most DeFi stacks)
Required reading for any protocol integrating deposit/withdraw flows against external vaults
OpenZeppelin ships a solid ERC4626 implementation — which is exactly why it sits in Tier 1 of our research. But this repo exists to give developers a single, Foundry-native, audited library with consistent patterns across standards. Today our finance/ module only covers ERC-3156 (flash loans). Vault semantics — share/asset conversion, preview functions, rounding direction, inflation-attack mitigations — are absent, forcing consumers to mix OZ imports with Curated ERC contracts.
Adding ERC-4626 here is not about reinventing the wheel. It is about:
Completeness — vaults are core DeFi infrastructure, not an optional extension
Consistency — same NatSpec style, custom errors, fuzz coverage, and ERC-7201 upgradeable storage as every other standard in this repo
RWA pipeline — async and regulated vault flows (7540, 7943-adjacent use cases) assume a canonical 4626 base developers can extend without leaving the library
Edge cases: first depositor, empty vault, max uint bounds, non-standard decimals
Upgradeable init + storage layout isolation test
Documentation
Full NatSpec on all public/external functions and events
Inline notes on rounding direction and virtual-share mitigation
Implementation notes
Do not copy OZ verbatim — use the OZ implementation as a semantic reference, write from scratch for licensing cleanliness (same approach as other standards here)
Abstract base — like ERC3156FlashLender, expose hooks rather than a monolithic deployable vault; ship a minimal concrete mock in tests only
Permit (ERC-2612) — optional extension on the share token; document whether the base includes it or leaves it to subclasses
Fee-on-transfer / rebasing assets — document unsupported; revert or guard explicitly rather than silently mis-account
Security focus areas: first-depositor inflation, rounding favoring the vault, reentrancy on deposit/withdraw, preview vs execution drift
Why this matters
ERC-4626 (Tokenized Vaults) is the most widely deployed yield-bearing primitive in DeFi after ERC-20 itself. It reached Final in 2022 and is now the integration surface for lending markets, yield aggregators, structured products, and RWA vaults across every major chain.
Traction signals:
OpenZeppelin ships a solid
ERC4626implementation — which is exactly why it sits in Tier 1 of our research. But this repo exists to give developers a single, Foundry-native, audited library with consistent patterns across standards. Today ourfinance/module only covers ERC-3156 (flash loans). Vault semantics — share/asset conversion, preview functions, rounding direction, inflation-attack mitigations — are absent, forcing consumers to mix OZ imports with Curated ERC contracts.Adding ERC-4626 here is not about reinventing the wheel. It is about:
Spec: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-4626.md
Discussions: https://ethereum-magicians.org/t/eip-4626-yield-bearing-vault-standard/7900
Requires: ERC-20, ERC-2612 (permit optional but recommended)
Scope
Per the per-ERC workflow:
Interfaces (
src/finance/ERC4626/)IERC4626.sol— full vault interface (asset,totalAssets,convertToShares/convertToAssets,maxDeposit/maxMint/maxWithdraw/maxRedeem, preview functions,deposit/mint/withdraw/redeem, events)Non-upgradeable implementation
ERC4626.sol— abstract ERC-20 + ERC-4626 base_deposit,_withdrawfor subclasses to override fee/yield logicUpgradeable implementation
ERC4626Upgradeable.sol— Initializable + ERC-7201 namespaced storageTests (
test/finance/ERC4626.t.sol)preview*matches executed amounts within rounding boundsDocumentation
Implementation notes
ERC3156FlashLender, expose hooks rather than a monolithic deployable vault; ship a minimal concrete mock in tests onlyRelationship to other issues
ERC4626, not an external OZ importsrc/finance/as the two core DeFi liquidity primitivesAcceptance criteria
IERC4626,ERC4626, andERC4626Upgradeableimplemented undersrc/finance/ERC4626/forge testpasses with unit + fuzz coverage of conversion invariants and roundingforge fmt --checkclean