Skip to main content

Help update this page

🌏

There’s a new version of this page but it’s only in English right now. Help us translate the latest version.

Translate page
See English

No bugs here!πŸ›

This page is not being translated. We've intentionally left this page in English for now.

ERC-4626 Tokenized Vault Standard

Last edit: , Invalid DateTime
Edit page

Introduction

ERC-4626 is a standard to optimize and unify the technical parameters of yield-bearing vaults. It provides a standard API for tokenized yield-bearing vaults that represent shares of a single underlying ERC-20 token. ERC-4626 also outlines an optional extension for tokenized vaults utilizing ERC-20, offering basic functionality for depositing, withdrawing tokens and reading balances.

The role of ERC-4626 in yield-bearing vaults

Lending markets, aggregators, and intrinsically interest-bearing tokens help users find the best yield on their crypto tokens by executing different strategies. These strategies are done with slight variation, which might be error-prone or waste development resources.

ERC-4626 in yield-bearing vaults will lower the integration effort and unlock access to yield in various applications with little specialized effort from developers by creating more consistent and robust implementation patterns.

The ERC-4626 token is described fully in EIP-4626.

Prerequisites

To better understand this page, we recommend you first read about token standards and ERC-20.

ERC-4626 Functions and Features:

Methods

asset

1function asset() public view returns (address)
2
πŸ“‹ Copy

This function returns the address of the underlying token used for the vault for accounting, depositing, withdrawing.

totalAssets

1function totalAssets() public view returns (uint256)
2
πŸ“‹ Copy

This function returns the total amount of underlying assets held by the vault.

convertToShares

1function convertToShares(uint256 assets) public view returns (uint256 shares)
2
πŸ“‹ Copy

This function returns the amount of shares that would be exchanged by the vault for the amount of assets provided.

convertToAssets

1function convertToAssets(uint256 shares) public view returns (uint256 assets)
2
πŸ“‹ Copy

This function returns the amount of assets that would be exchanged by the vault for the amount of shares provided.

maxDeposit

1function maxDeposit(address receiver) public view returns (uint256)
2
πŸ“‹ Copy

This function returns the maximum amount of underlying assets that can be deposited in a single deposit call by the receiver.

previewDeposit

1function previewDeposit(uint256 assets) public view returns (uint256)
2
πŸ“‹ Copy

This function allows users to simulate the effects of their deposit at the current block.

deposit

1function deposit(uint256 assets, address receiver) public returns (uint256 shares)
2
πŸ“‹ Copy

This function deposits assets of underlying tokens into the vault and grants ownership of shares to receiver.

maxMint

1function maxMint(address receiver) public view returns (uint256)
2
πŸ“‹ Copy

This function returns the maximum amount of shares that can be minted in a single mint call by the receiver.

previewMint

1function previewMint(uint256 shares) public view returns (uint256)
2
πŸ“‹ Copy

This function allows users to simulate the effects of their mint at the current block.

mint

1function mint(uint256 shares, address receiver) public returns (uint256 assets)
2
πŸ“‹ Copy

This function mints exactly shares vault shares to receiver by depositing assets of underlying tokens.

maxWithdraw

1function maxWithdraw(address owner) public view returns (uint256)
2
πŸ“‹ Copy

This function returns the maximum amount of underlying assets that can be withdrawn from the owner balance with a single withdraw call.

previewWithdraw

1function previewWithdraw(uint256 assets) public view returns (uint256)
2
πŸ“‹ Copy

This function allows users to simulate the effects of their withdrawal at the current block.

withdraw

1function withdraw(uint256 assets, address receiver, address owner) public returns (uint256 shares)
2
πŸ“‹ Copy

This function burns shares from owner and send exactly assets token from the vault to receiver.

maxRedeem

1function maxRedeem(address owner) public view returns (uint256)
2
πŸ“‹ Copy

This function returns the maximum amount of shares that can be redeem from the owner balance through a redeem call.

previewRedeem

1function previewRedeem(uint256 shares) public view returns (uint256)
2
πŸ“‹ Copy

This function allows users to simulate the effects of their redeemption at the current block.

redeem

1function redeem(uint256 shares, address receiver, address owner) public returns (uint256 assets)
2
πŸ“‹ Copy

This function redeems a specific number of shares from owner and send assets of underlying token from the vault to receiver.

totalSupply

1function totalSupply() public view returns (uint256)
2
πŸ“‹ Copy

Returns the total number of unredeemed vault shares in circulation.

balanceOf

1function balanceOf(address owner) public view returns (uint256)
2
πŸ“‹ Copy

Returns the total amount of vault shares the owner currently has.

Events

Deposit Event

MUST be emitted when tokens are deposited into the vault via the mint and deposit methods

1event Deposit(
2 address indexed sender,
3 address indexed owner,
4 uint256 assets,
5 uint256 shares
6)
7
πŸ“‹ Copy

Where sender is the user who exchanged assets for shares, and transferred those shares to owner.

Withdraw Event

MUST be emitted when shares are withdrawn from the vault by a depositor in the redeem or withdraw methods.

1event Withdraw(
2 address indexed sender,
3 address indexed receiver,
4 address indexed owner,
5 uint256 assets,
6 uint256 share
7)
8
πŸ“‹ Copy

Where sender is the user who triggered the withdrawal and exchanged shares, owned by owner, for assets. receiver is the user who received the withdrawn assets.

Further reading

Was this article helpful?

πŸ‘ˆ

Previous

ERC-1155

Next

Maximal extractable value (MEV)
πŸ‘‰
Website last updated: September 26, 2022

Use Ethereum

  • Find wallet
  • Get ETH
  • Decentralized applications (dapps)
  • Layer 2
  • Run a node
  • Stablecoins
  • Stake ETH

Ecosystem

  • Community hub
  • Ethereum Foundation
  • Ethereum Foundation Blog
  • Ecosystem Support Program
  • Ethereum bug bounty program
  • Ecosystem Grant Programs
  • Ethereum brand assets
  • Devcon