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