Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

ERC-7575 extends ERC-4626 to enable more flexible asset management and support deposits and withdrawals involving multiple assets.

This article translates, summarizes, and expands on the following specification.

For other EIPs, see:

Overview

First, let's establish what ERC-4626, ERC-20, and ERC-165 mean.

ERC-4626

ERC-4626 is an Ethereum smart contract standard for asset vaults. A vault is a mechanism through which users can deposit and withdraw assets such as cryptocurrencies.

For more information about ERC-4626, see the following article.

[ERC4626] Understanding the Standard for Tokenized Vaults and Rewards

ERC-4626 is a standard for asset vaults operating on Ethereum. A vault here is a smart contract into which users can deposit digital assets such as cryptocurrencies or tokens.

The standard defines a common set of behaviors and rules for deposits and withdrawals, aiming to standardize asset management and promote compatibility between projects.

Key Features and Goals

  • Standardized Interface

    • ERC-4626 provides a uniform interface for common vault operations, including deposits, withdrawals, and accounting for interest or rewards associated with assets.
    • This promotes compatibility across vaults and makes the systems easier for users and developers to understand and use.
  • Greater Transparency

    • Compliance with the standard makes the vault's asset management processes more standardized and transparent.
    • Investors and users can more readily understand how their assets are managed.
  • Interoperability

    • Assets can be moved and managed more readily across projects and applications.
    • For example, ERC-4626 vaults can be integrated into a variety of decentralized finance (DeFi) platforms and investment strategies.
  • Extensibility

    • While the standard provides a common interface, individual vaults can implement their own functionality and rules on top of it.
    • This allows customization for different requirements.

Use Cases

  • Investment Vaults
    • Vaults that use deposited tokens to pursue various investment strategies and generate returns.
  • Savings Accounts
    • Savings vaults that generate interest periodically.
  • Liquidity Pools
    • Vaults that provide liquidity for specific token pairs and receive fees or other incentives in return.

ERC-4626 provides a foundation for these vaults to manage assets consistently and offer transparent, reliable services to users.

ERC-20

ERC-20 is the Ethereum token standard. Many tokens follow it, and it defines basic operations such as token issuance, transfers, and balance checks.

For more information about ERC-20, see the following article.

https://chaldene.net/erc20

ERC-165

ERC-165 is a standard for identifying which interfaces a smart contract supports. It allows applications to check programmatically whether a contract supports particular features or standards.

For more information about ERC-165, see the following article.

[ERC165] Checking Whether a Contract Supports an Interface

Multi-Asset Support and a New Share Mechanism

The proposed standard extends ERC-4626 to support multiple assets and multiple entry points. This allows several different assets to be deposited in exchange for a single share token.

By introducing a new way to represent shares, it externalizes the dependency on ERC-20, so the vault no longer has to manage the ERC-20 token directly.

This even makes it possible to create a vault without its own share token: a simple vault that only converts between two external tokens.

Mandatory ERC-165 Support

The new standard requires all vaults to support ERC-165. This makes it easier to identify the capabilities supported by a vault and enables integration and interoperability across a wider range of vaults.

The new standard aims to make asset management more flexible, facilitate conversion between different assets and tokens, and make vault capabilities easier to identify.

Motivation

ERC-4626 is a vault standard, but it does not cover every use case.

Limitations of ERC-4626

ERC-4626 generally requires the vault to comply with the ERC-20 token standard. In other words, the token representing the assets in a vault must behave as an ERC-20 token.

Vaults with Multiple Assets or Entry Points

In practice, some vaults handle multiple assets or have multiple entry points. One example is a vault dealing with liquidity provider (LP) tokens.

LP tokens are received when users provide assets to a liquidity pool and represent a portion of the assets in that pool.

Incompatibility with ERC-4626

Such vaults may hold several different types of assets or provide entry points through complex operations, such as supplying liquidity for a particular asset pair.

In these cases, a single ERC-20 token may not adequately represent the vault's behavior.

It can therefore be difficult or impossible for more complex vaults to comply with ERC-4626, whose original assumptions are based on the relatively simple case of a vault that handles only one asset type.

The existing structure of ERC-4626 may not meet the needs of vaults handling multiple assets or supporting more complex instruments such as LP tokens. These are special cases that do not fit easily into the ERC-20 token framework.

Specification

Definitions

Existing ERC-4626 Definitions

ERC-4626 is a standard for asset vaults operating on Ethereum. A vault is a smart contract that allows users to deposit and withdraw digital assets (tokens). ERC-4626 defines a standard set of interfaces and rules for these operations.

Multi-Asset Vaults

A multi-asset vault is a vault that can accept several different assets (tokens), or allows assets to be deposited through several different methods (entry points).

Unlike a conventional vault that accepts only one token, a multi-asset vault can support more complex asset management and a wider variety of investment strategies.

Pipes

A pipe is a converter that exchanges one token for another. This conversion may be unidirectional or bidirectional.

A pipe allows users to convert a token they own into another token accepted by a vault and subsequently deposit the converted token into the vault.

This makes vaults more convenient to use and allows them to handle a wider range of assets.

These terms describe extensions to ERC-4626 vaults that allow users to manage different asset types more flexibly. Multi-asset vaults enable users to manage multiple tokens in one vault, while pipes facilitate token conversions.

Methods

The share method of a vault defines the representation of the shares received when assets are deposited. In particular, it specifies how shares associated with the vault are handled.

The Role of the share Method

The share method returns the address of the vault's ERC-20 token representation: the token representing shares in the vault.

This allows users to identify the token they receive as shares when they deposit assets.

Handling Shares

share may return the vault's own address. In that case, the vault itself serves as the token representation of its shares.

If share returns an external token address instead (share != address(this)), the following rules apply.

text
- **Entry functions** (functions that deposit assets into the vault) must increase the recipient's share balance (`share.balanceOf(receiver) += shares`).
- **Exit functions** (functions that withdraw assets from the vault) must decrease the owner's share balance (`share.balanceOf(owner) -= shares`).

The method must not revert, even when an operation fails.

Structure of the share Method

yaml
- name: share
  type: function
  stateMutability: view

  inputs: []
  outputs:
    - name: shareTokenAddress
      type: address
  • Function Name
    • share
  • Type
    • Function
  • State Mutability
    • view, meaning that the function does not modify state and can be read externally.
  • Inputs
    • None.
  • Outputs
    • Name
      • shareTokenAddress
    • Type
      • address, the address of the ERC-20 token representing shares.

By defining how the shares associated with a vault are handled, the method helps improve transparency and predictability when users deposit or withdraw assets.

Multi-Asset Vaults

A multi-asset vault manages multiple assets (tokens) within a single vault and shares one token representing them.

An entry point is a way or access point through which assets can be deposited. Different entry points may correspond to different asset tokens.

Characteristics of Multi-Asset Vaults

Single Share Token

Regardless of the variety of assets held in the vault, a multi-asset vault uses a single share token to represent each user's stake.

Users receive the same share token even when they deposit different types of assets.

Multiple Entry Points

These vaults offer multiple entry points represented by different asset tokens, allowing users to participate in a vault using the asset of their choice.

Implementation Requirements

Implementing the share Method

A multi-asset vault must implement the share method at each entry point.

This ensures that users' stakes are properly accounted for and the appropriate share token is issued regardless of the entry point through which they deposit assets.

Non-ERC-20 Entry Points

Entry points should not themselves be ERC-20 tokens.

Depositing and withdrawing assets requires operations distinct from ordinary ERC-20 transfers and receipts. Entry points provide functionality specifically for deposits and withdrawals, each supporting a different asset type.

Multi-asset vaults give users the flexibility to participate in a single vault using different assets. Their stakes are managed uniformly through one share token, regardless of the assets used. This approach simplifies vault management and the user experience while supporting different assets.

Pipes

A pipe in the context of multi-asset vaults is a mechanism for converting between an asset (token) and the vault's share token.

A share here is a token representing the user's stake in a vault, received when the user deposits assets.

Pipes let users convert ERC-20 tokens they hold into vault share tokens. This conversion takes place outside the vault.

Characteristics of Pipes

Converting Between a Single Asset and Shares

A pipe converts a particular asset held by the user (an ERC-20 token) into a vault share token. The reverse conversion may also be supported, depending on the pipe's directionality.

Directionality

There are two types of pipes: unidirectional and bidirectional.

Unidirectional Pipes

A unidirectional pipe supports only conversion from assets to shares. Its primary use is depositing assets.

Bidirectional Pipes

A bidirectional pipe supports conversion from assets to shares and the reverse. Users can therefore both deposit assets into a vault and convert shares back into assets.

Unidirectional Pipe Operations

A unidirectional pipe implements only entry functions such as deposit and mint. These functions convert assets held by the user into the vault's share token.

Deposit

The user sends assets to the pipe and receives the corresponding quantity of share tokens.

Mint

New share tokens are generated from the user's assets under specified conditions.

Pipes enable flexible conversion between vault shares and users' assets, allowing more complex asset management strategies and improving the user experience.

ERC-165 Support

Smart contracts implementing ERC-7575 must also support the ERC-165 standard.

ERC-165

ERC-165 is a standard for detecting whether smart contracts support particular interfaces. It enables external parties to determine whether a contract complies with a specific standard or supports a particular feature.

The ERC-165 supportsInterface Function

This function checks whether a smart contract supports a specified interface.

Its interfaceID parameter accepts the identifier of the interface to check. The function returns true if the interface is supported and false otherwise.

Relationship to ERC-7575

A smart contract implementing ERC-7575 must implement supportsInterface and return true when the specified interfaceID is 0x2f0a18c5.

ERC-7575 therefore corresponds to that particular interface identifier. Other contracts and users can use this functionality to determine programmatically whether a smart contract supports ERC-7575.

Share-to-Vault lookup

An ERC-20 token, referred to here as a share, needs a function named vault to return a vault address associated with a particular asset.

The Role of the vault Function

This function returns the address of the vault associated with a specified asset (asset).

It provides a way for users to determine which vault corresponds to a share token they hold.

Function Specification

  • Function Name
    • vault
  • Type
    • Function
  • State Mutability
    • view, indicating that the function does not modify blockchain state and can be read externally.

Input

  • Asset Address (asset)
    • Address of the asset for which the user wants to find the vault.

Output

  • Vault Address (vault)
    • Address of the vault in which the user's shares correspond to the specified asset.

Use Cases

A typical use case is when users want to identify the vault associated with their share tokens.

For example, a user who has deposited assets into several vaults and holds share tokens from each can readily determine which vault each token belongs to.

The vault function provides useful information to users, simplifies asset management across vaults, and can improve system transparency.

yaml
- name: vault
  type: function
  stateMutability: view

  inputs: 
    - name: asset
      type: address
    
  outputs:
    - name: vault
      type: address

Rationale

The standard is designed to be easy to apply to existing ERC-4626 vaults while providing enough flexibility for new use cases.

Externalizing the ERC-20 Dependency

The proposal allows the share token representing a stake in a vault to have an address distinct from the vault itself (share != address(this)).

This allows the vault to use an external contract that manages the ERC-20 functionality of shares.

The approach is particularly useful for multi-asset vaults, avoiding the confusion that could arise if every vault had to act as an ERC-20 token itself. This reduces ambiguity for integrators and frontends.

Creating New Types of Vaults

This approach also makes a new type of vault called a pipe possible.

Pipes facilitate conversion between two external ERC-20 tokens. They may be unidirectional, supporting only conversion from assets to shares, for example, or bidirectional, supporting both entry and exit flows.

Looking Up a Vault from a Share

The introduction of the vault method makes it easy to find a vault associated with shares for a specific asset, simplifying the integration of multi-asset vaults.

The method is optional, preserving backward compatibility when previously deployed contracts serve as shares.

The proposal makes managing vaults and their shares more flexible and supports new use cases. New kinds of vaults can be created while retaining existing vaults, encouraging innovation and growth across the ecosystem.

Compatibility

The compatibility discussion for ERC-4626 and ERC-7575 describes a simple way to adapt existing ERC-4626 vaults to the new ERC-7575 standard.

Compatibility with ERC-7575

ERC-7575 adds functionality and extensibility to existing ERC-4626 vaults. In particular, it introduces the share method.

Adding the Share Method

Adding the share method to a vault allows it to return its own address. This helps meet the requirements of ERC-7575 and lets the vault expose its address to external callers through the method.

Existing ERC-4626 vaults can be adapted to ERC-7575 with minimal changes required by the new standard.

Security

Vaults that do not themselves comply with ERC-20 must be careful when supporting the redeem flow for owners other than msg.sender, the address initiating the call.

Security Issue

When the vault and share token are separate contracts, the ERC-20 approval flow alone may be insufficient to support withdrawals properly.

Because the vault cannot directly authorize transfer on the share token, it may be difficult to process redemption requests correctly when the owner is not msg.sender.

Solution: transfer with ERC-2771

One proposed solution is to use ERC-2771 and configure the vault as a Trusted Forwarder for the share token.

ERC-2771 is a standard for supporting meta-transactions, allowing users to submit transactions without paying the gas costs themselves.

With this standard, a vault can act on behalf of the share token owner, enabling operations such as token transfers and withdrawals on the owner's behalf even when msg.sender is not the actual token owner.

Vaults that do not comply with ERC-20 must be careful when supporting withdrawals not initiated directly by the owner. By using ERC-2771, these vaults can act as a trusted forwarder for share token transfer calls, mitigating security risks while providing convenient withdrawal flows.

For more information about ERC-2771, see the following article.

[ERC2771] Understanding Meta-Transactions and Sponsored Gas Fees

Citation

Jeroen Offerijns (@hieronx), Alina Sinelnikova (@ilinzweilin), Vikram Arun (@vikramarun), Joey Santoro (@joeysantoro), Farhaan Ali (@0xfarhaan), "ERC-7575: Multi-Asset ERC-4626 Vaults [DRAFT]," Ethereum Improvement Proposals, no. 7575, December 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7575.

Conclusion

ERC-7575 extends ERC-4626 to enable more flexible asset management and deposits and withdrawals involving different assets.

If you have questions, feel free to send me a direct message on Twitter.

Twitter @cardene777

I also publish material on other platforms:

https://chaldene.net/