Lab: free tools · size first · stock scanner · crypto scanner · journal

General

ERC-4626 Tokenized Vault Standard

ERC-4626 is the Ethereum tokenized vault standard that defines a common interface for yield-bearing vaults. These are smart contracts that accept a token deposit and issue shares representing a proportional claim on the vault's assets plus accrued yield. It standardizes deposit, withdrawal, and share pricing functions so DeFi protocols can integrate yield vaults interoperably.

ERC-4626 standardizes yield-bearing vaults: you deposit a token and receive shares that represent your claim on the vault's growing balance. Because the interface is shared, other protocols can integrate any compliant vault without custom work. A standard interface does not make the strategy behind it safe. Share-price manipulation on empty or newly deployed vaults has been a known attack pattern.

How the interface works

ERC-4626 was written in December 2021 and builds on ERC-20, so vault shares are ordinary tokens you can transfer or use elsewhere. Every vault has the same core functions. deposit takes a set amount of the underlying token and mints shares; mint works from the other end, taking whatever is needed for a set number of shares. withdraw and redeem take money out the same two ways. Preview functions let an app check what you'd get before you sign, fees included. Lending markets, yield aggregators and interest bearing tokens all fit this mold.

A vault share example

A vault holds 200 USDC backing 100 shares, so each share is worth 2 USDC. You deposit 100 USDC and get 50 shares. If the strategy earns 10% and the vault grows to 330 USDC across 150 shares, each share is worth 2.20, and your 50 shares can be redeemed for 110 USDC. The standard rounds in the vault's favor, so you may lose a tiny fraction to rounding.

The empty vault attack

Rounding is where the known attack lives. An attacker deposits a tiny amount into a new, empty vault, then sends a large amount of tokens straight to it without minting shares. That pushes the share price so high that the next depositor's shares round down to zero, and the attacker owns everything. OpenZeppelin's version defends against this with virtual shares and a decimal offset, which make the attack cost far more than it could steal.

What the standard doesn't promise

The EIP's own security notes warn that a contract can match the interface while behaving badly, and tell integrators to review each vault before using it. A shared interface makes vaults easy to plug together, which also means one bad vault can spread losses to every protocol built on it. Read the strategy, check audits and be wary of depositing into a fresh vault that holds almost nothing, since that is when the rounding attack works.