
Smart Security Practices From The Best
What do Lido, Red Stone, YieldNest, and Braintrust have in common? They’ve developed effective methods for improving security without drastically increasing costs. Top-tier protocol […]
This article covers the basics of ERC4626. Take a helicopter view of how it works and what are the main security concerns that need to be addressed.
ERC4626 standardizes how vaults can handle and manage various assets. The main reason it was created was to enable easy and consistent integrations between DeFi projects. Tokenized vault allows for easy distribution of yield/rewards via shares. Essentially, it creates a more uniform and interoperable way to manage these investment products.
Depositing Money: When you put your ERC20 token (like a stablecoin) into the vault, you receive another special ERC20 token in return. These special tokens represent your share of the vault.
Earning Interest: The vault takes your money and invests it in various ways (like lending it out) to earn interest.
Withdrawing Funds: When you want your money back, you can exchange your special ERC20 tokens for the proportional value of your shares (your original deposit plus an adequate proportion of the total interest earned).
Example:
While ERC4626 can theoretically be used with any ERC-20 token, its practical applications are most commonly seen with stablecoins and yield-bearing tokens within DeFi ecosystems. When creating a vault, the selected underlying token is defined as an asset.
Each ERC-4626 vault is designed to handle only one underlying asset, which means you cannot deposit multiple kinds of tokens into a single ERC4626 contract and receive shares back for those deposits. However, there is an evolving proposal known as ERC7575, which extends the ERC4626 interface to support multi-asset vaults.
Collaboration Between Protocols: The standard allows different DeFi protocols to work together more easily. This can lead to better opportunities for users, as they can move their assets across platforms seamlessly.
New Offerings: The ERC4626 standard opens the door for creative financial products. Developers can create various vault strategies tailored to different risk appetites and investment goals.
Liquidity for users: User funds remain liquid and without withdrawal they may trade on the market and use their tokens as collateral because at any time another person can exchange the shares back to the original token.
Contact with specialist
Damian Rusinek
Managing Partner & Smart Contract Security Audito
Aave: Aave has integrated ERC4626 into its platform, enabling users to deposit and withdraw ERC20 tokens supported by Aave v3. It manages the supply and withdrawal of these assets in Aave, and allows a vault manager to take a fee on yield earned.
Yearn Finance: Yearn utilizes the “Tokenized Strategy” to simplify the creation and deployment of ERC-4626 compliant yield-generating vaults. It allows anyone to create their own strategy-specific vault by outsourcing standard vault logic to a shared implementation contract via delegatecall.
Euler: Euler utilizes the ERC4626 standard through its Euler Vault Kit (EVK), which is designed to construct ERC4626 vaults with enhanced functionalities for lending platforms.
To see more examples check the ERC4626 vaults repository.
At the time of writing, Solodit indicates 265 findings related to ERC4626, of which 169 are HIGH and MEDIUM severity findings. That clearly indicates that mistakes happen during the implementation of this standard and they have a significant impact on the security of the entire project. The most common issues concern:
Vaults are designed to allow the exchange rate between shares and assets to change over time. To determine the price of a vault share, you can simply divide the total amount of tokenA deposited in the vault by the total number of tokenS (shares) issued. As the vault earns more yield, the exchange rate for the shares improves, benefiting the holders.
However, attackers might want to influence this exchange rate by various types of donations (direct, stealth).
To prevent:
Not following the standard strictly not only introduces new risks but also makes integration with other projects more difficult. In this way, both your users and projects that will be integrated with you might be exposed to vulnerabilities.
To prevent:
Be compliant with all MUST of ERC4626
Audit the code
To assist vault developers in identifying potential violations of standard that could disrupt integrations or introduce vulnerabilities in the future, we recommend checking prepared by a16z properties for fuzzing and symbolic execution techniques.
Composable Security 🛡️⛓️ is an elite team of 2 experienced Security Researchers who specialize in (re)staking, AVS and UniswapV4 projects.
Uniswap Foundation grant recipient. Creators of the Smart Contract Security Verification Standard and the first Security Guide for DApps CTOs, Lead Developers, and Security Enthusiasts.
Have peace of mind like: Braintrust, Enjin, Tellor, Volmex Finance and many more.
Meet Composable Security
Get throughly tested by the creators of Smart Contract Security Verification Standard
Let us help
Get throughly tested by the creators of Smart Contract Security Verification Standard