Skip to content

[RESEARCH] ERC4626 support & customization #281

Open

Description

@maxnorm

Question for research

Should Compose Support an ERC-4626 Implementation?

Before deciding whether to include an ERC-4626 implementation in Compose, we would like to conduct research on how ERC-4626 is actually used and extended in projects.

Research Question

How is ERC-4626 customized in the wild?

Specifically:

  • How do real-world projects extend ERC-4626 implementations?
  • Do most vaults override core functions?
  • Are teams typically inheriting from OpenZeppelin’s implementation or other contract lib?
  • Is there meaningful value in providing a reusable facet version inside Compose?

Context

The development is currently blocked for ERC4626 (See related Issue & PR)

The hesitation to include ERC-4626 in Compose is based on the following concerns:

  • Many/most vaults will have custom versions of these standard functions, and so will not use provided version by Compose facets.
  • This vault standard add some complexity with the muldiv function (that can be delayed if we don't include ERC-4626)

This research will be used to make a more inform decision on the addition or not of ERC-4626 (and all other standards based on it like ERC-7540)

Helpful Information

Have a question? Please check our contribution guide first - your answer might already be there!

Want to discuss something? For general questions, ideas, or brainstorming, please browse our discussions or start a new one.

You can also join our Discord to discuss the question.

Activity

  1. added
    Question
    Good First Issue
    on Feb 26, 2026
  2. jhuhnke commented on Feb 26, 2026

    @jhuhnke
    Contributor

    Gm @maxnorm happy to claim this if 2-3 weeks is an acceptable timeline, just lmk

  3. maxnorm commented on Feb 26, 2026

    @maxnorm
    CollaboratorAuthor

    Heyyy @jhuhnke, of course, take the time you need for this! Thanks for the help.

    I don't have a format expectation. You can either add a big comment in the issue directly or create a doc somewhere we can read it

  4. jhuhnke commented on Feb 26, 2026

    @jhuhnke
    Contributor

    Sounds great! I'll share a working doc in the next week and create a "big" comment when done for visibility as well.

  5. aapsi commented on Mar 6, 2026

    @aapsi
    Contributor

    Hi @jhuhnke @maxnorm
    I can help out too with this. I have experience building a vault that's on mainnet. Happy to help with anything

  6. maxnorm commented on Mar 6, 2026

    @maxnorm
    CollaboratorAuthor

    Of course! @aapsi

    Please share any insights you have.

  7. jhuhnke commented on Mar 10, 2026

    @jhuhnke
    Contributor

    Yes please feel free to share any experiences you have @aapsi

    My plan is to make an outline of major open-source protocols the ERC-4626 standard on Thursday and then write up my findings this Saturday. I'm happy to include anything you share with me as well.

  8. jhuhnke commented on Mar 14, 2026

    @jhuhnke
    Contributor

    ERC4626 in Practice

    How Tokenized Vaults Are Implemented Across DeFi

    Abstract

    The ERC-4626 tokenized vault standard was introduced to standardize yield bearing vaults in Ethereum based decentralized finance. The specification defines a uniform interface that allows users to deposit assets, receive vault shares, and later redeem those shares for underlying assets. While the interface is widely adopted, production implementations often extend or modify the base design.

    This report surveys several major DeFi protocols that implement ERC-4626 or ERC-4626 compatible vaults and analyzes how the standard is extended in practice. The findings show that most vault implementations override core accounting functions and introduce custom strategy layers. These patterns suggest that ERC-4626 primarily serves as an interoperability interface rather than a complete vault implementation.


    1. Introduction

    ERC-4626 defines a standardized interface for tokenized vaults built on top of ERC-20 assets. Vaults allow users to deposit tokens into a contract that deploys those assets into yield generating strategies. In return, users receive vault shares representing their proportional claim on the vault.

    The specification defines several core functions that allow external applications to interact with vaults in a consistent way.

    Core functions include

    deposit
    mint
    withdraw
    redeem
    totalAssets
    convertToShares
    convertToAssets
    

    The standard was introduced to improve composability within the Ethereum ecosystem. Wallets, aggregators, and protocols can interact with vaults using a common interface regardless of the strategy behind the vault.

    The full specification can be found in the official Ethereum Improvement Proposal.

    https://eips.ethereum.org/EIPS/eip-4626

    However, ERC-4626 intentionally standardizes only the vault accounting interface. The specification does not define how assets are invested or how yield is generated. As a result, vault implementations often introduce additional architecture layers and custom logic.


    2. Methodology

    This report examines several production DeFi protocols that implement ERC-4626 vaults or ERC-4626 compatible vault systems.

    Protocols analyzed include

    • Yearn Finance

    • Idle Finance

    • mStable

    • StakeWise

    • Frax Finance

    • Sommelier Finance

    • Ribbon Finance

    • Maple Finance

    • Venus Protocol

    For each protocol the following characteristics were analyzed

    Vault architecture
    Source code implementation
    Inheritance patterns
    Customization of ERC-4626 methods

    Primary sources include protocol documentation and public contract repositories.


    3. ERC-4626 Base Implementations

    Most vault implementations begin by inheriting from an existing open source library.

    Two implementations dominate the ecosystem.

    OpenZeppelin Implementation

    The most widely audited implementation is maintained by OpenZeppelin.

    Repository
    https://github.com/OpenZeppelin/openzeppelin-contracts

    Relevant contract location

    contracts/token/ERC20/extensions/ERC4626.sol
    

    The OpenZeppelin implementation provides a secure reference vault that implements the ERC-4626 specification and allows developers to override internal functions for custom behavior.

    Documentation
    https://docs.openzeppelin.com/contracts/4.x/erc4626


    Solmate Implementation

    A minimal and gas efficient implementation is provided by the Solmate library.

    Repository
    https://github.com/transmissions11/solmate

    Solmate provides a compact implementation commonly used in performance focused DeFi protocols.


    Custom Implementations

    Several major protocols implement their own ERC4626 compatible vault logic. This approach is common for systems that include complex strategy management, staking integrations, or lending mechanisms.

    Custom implementations are particularly common in multi strategy vault systems.


    4. Customization of ERC-4626 in Major Protocols

    Protocol Vault Type Base Library Customization
    Yearn Yield aggregator Custom implementation Strategy manager controlling multiple strategies
    Idle Yield aggregator Custom implementation Allocation across multiple lending markets
    mStable Meta vault OpenZeppelin extension Vault composed of other ERC4626 vaults
    StakeWise Liquid staking Custom implementation Validator staking pools
    Frax sfrxETH Liquid staking Solmate style base Staking rewards accrue inside vault
    Sommelier Strategy vault Custom implementation Allocation determined by governance
    Ribbon Structured product vault Custom implementation Options selling strategy
    Maple Lending vault Custom implementation Lending pool issuing credit to borrowers
    Venus Lending wrapper OpenZeppelin extension Wrapper around lending markets

    5. Commonly Overridden ERC-4626 Functions

    Analysis of production vaults shows that most implementations override at least one core ERC-4626 function.

    totalAssets

    The totalAssets function determines the value of assets controlled by the vault. In many implementations this function includes assets deployed in external protocols.

    Example calculation

    vault balance
    plus strategy positions
    plus pending rewards
    

    Deposit Logic

    Vault implementations often modify deposit logic to allocate capital to strategies.

    Typical flow

    deposit
    vault receives assets
    vault forwards assets to strategy
    

    Withdrawal Logic

    Withdrawals frequently require unwinding strategy positions before assets can be returned to users. As a result, withdrawal functions often include additional accounting and strategy interaction.


    6. Dominant ERC-4626 Architectural Patterns

    Analysis of production vault systems reveals six dominant architectural patterns.


    Simple Yield Vault

    Users deposit assets into a vault that deploys capital into a single strategy.

    Examples

    • Frax Finance sfrxETH

    • Morpho vaults

    Architecture

    User
    Vault
    Strategy
    

    Strategy Aggregator Vault

    The vault allocates funds across multiple strategies.

    Examples

    • Yearn Finance

    • Idle Finance

    Architecture

    User
    Vault
    Strategy manager
    Multiple strategies
    

    Vault of Vaults

    Meta vaults allocate deposits across multiple ERC4626 vaults.

    Example

    • mStable MetaVaults

    Architecture

    User
    Meta vault
    Multiple ERC-4626 vaults
    

    Strategy Specific Vault

    Vaults dedicated to a single trading or yield strategy.

    Examples

    • Ribbon Finance

    • Sommelier Finance

    Architecture

    User
    Vault
    Custom strategy
    

    Lending Vault

    Vault deposits are lent to borrowers through a lending pool.

    Examples

    • Maple Finance

    • Venus Protocol

    Architecture

    User
    Vault
    Credit pool
    Borrowers
    

    Liquid Staking Vault

    Vault shares represent claims on staked assets.

    Examples

    • StakeWise

    • Frax Finance

    Architecture

    User
    Vault
    Validator set
    

    7. Key Findings

    ERC-4626 has become the dominant vault interface standard within DeFi ecosystems.

    Most production vault implementations extend the standard rather than using the base contract without modification.

    Nearly all systems separate vault accounting from strategy execution.

    The most frequently customized functions include

    totalAssets
    deposit
    withdraw
    

    Most protocols inherit from one of three implementation approaches

    OpenZeppelin ERC-4626 implementation
    Solmate ERC-4626 implementation
    Custom vault implementations


    8. Conclusion

    ERC4626 has emerged as the dominant standard interface for tokenized vaults in decentralized finance. Its primary contribution is standardizing vault interactions such as deposits, withdrawals, and share accounting.

    However, examination of major production vaults shows that most implementations significantly extend the base standard. Protocols frequently override core functions, introduce custom accounting logic, and integrate additional strategy layers that fall outside the scope of ERC-4626.

    For developers building new tooling or contract libraries, this suggests that the base ERC-4626 implementation itself may not be the primary source of friction. Instead, the complexity lies in the custom extensions required by real world vault designs.

    Consequently, developer libraries may provide greater value by simplifying the extension and customization of ERC-4626 rather than by providing a fixed base implementation.


    References

    ERC-4626 specification
    https://eips.ethereum.org/EIPS/eip-4626

    OpenZeppelin ERC-4626 implementation
    https://github.com/OpenZeppelin/openzeppelin-contracts

    Solmate vault implementation
    https://github.com/transmissions11/solmate

    Yearn V3 vault contracts
    https://github.com/yearn/yearn-vaults-v3

    StakeWise V3 contracts
    https://github.com/stakewise/v3-core

    Maple protocol contracts
    https://github.com/maple-labs/maple-core

    Frax contracts
    https://github.com/FraxFinance

  9. maxnorm commented on Mar 22, 2026

    @maxnorm
    CollaboratorAuthor

    Thank you @jhuhnke ! This will be greatly valuable. @aapsi If you have anything else to add from your experience, it would be great.

    I will evaluate this after the library & cli beta release. Which i hope is sooon

  10. aapsi commented on Apr 3, 2026

    @aapsi
    Contributor

    Hi @jhuhnke , this is some good research 👌
    @maxnorm I will go through it and add to it if I have any aditional pointers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Good First IssueNeeds ReviewQuestion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions