ERC-4626 Tokenized Vault Standard
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コピー
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コピー
This function returns the total amount of underlying assets held by the vault.
convertToShares
1function convertToShares(uint256 assets) public view returns (uint256 shares)2コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
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コピー
Returns the total number of unredeemed vault shares in circulation.
balanceOf
1function balanceOf(address owner) public view returns (uint256)2コピー
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 shares6)7コピー
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 share7)8コピー
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.