ERC-4626

Manmeet
6 min readMay 22, 2023

--

In this article, we are going to discuss the ERC-4626. To understand this first we need to know, What is the need of ERC-4626?

When something new is introduced in markets there are lots of efforts and ideas behind it. Whenever developers or the community create a proposal or idea, they try to reduce the problem associated with it and want to make changes into the ongoing scenario. Same case is with ERC-4626.

Before ERC-4626 there was no standardisation for lending, staking and yield farming vaults. Every protocol which implements the vault feature in his application, uses his own method and strategy to create vaults. There was no standardisation for vaults, which caused waste of time and development resources. Every protocol has its own interface, its own adapter and its own strategy to create a vault .

Let’s take an example where a vault faces lack of standardisation

Suppose there are 3 protocols that want to implement a vault in his application. And the vault should have 3 functions. One for depositing assets, one for withdrawal assets and one for giving the information of total assets into the vault.

All three protocols have to create the same methods but because of no standardisation each protocol tries to implement methods with different names, which increase the cost and complexity of the code. Each protocol has its own interface and adopters.

To solve the above problems ERC-4626 comes with the idea of “Tokenized Vaults with a single underlying EIP-20 token” which is an extension of the ERC-20 token, where you can also deposit and withdraw your token and also get yield over the time period on your deposited assets.

Let’s Deep dive into the ERC-4626

ERC-4626

ERC-4626 is a standard for vaults, which is the extension of the ERC-20 token that comes with a tokenized vault facility. Vaults represent your share in the form of vault Token minted by the vaults on behalf of the assets that you provided to the vault. In simple words ERC-4626 is a “Tokenized Vault with a single underlying EIP-20 token”.

Vault has its own strategy and methods, on the basis of the strategy it tries to invest your assets into the different protocol to maximise your yield profit.

Let’s understand what yield-bearing vaults are.

Yield-bearing vaults are smart contracts that follow some strategy for higher returns. Yield-bearing vaults allow users to deposit their ERC-20 token into a pool of tokens and on behalf of the deposited assets it mints vault tokens to the depositor, which represent your share.

How Yield bearing vaults are able to maximise profit?

Yield bearing vault maximises the profit by depositing into the most profitable protocol. To find the most profitable protocol, the vault assigns a rank to different protocols according to the most profitable protocol and on the basis of rank, they deposit a fraction of the token into the different protocols and keep some reserve to deal with the withdrawal condition.

Above mentioned diagram shows how yield-bearing vaults work to maximise profit.

Now let’s try to understand some functionality of the ERC-4626 standard.

ERC-4626 contain different function and events let’s discuss them one by one

Functions:

  • asset
  • totalAssets
  • convertToShares
  • convertToAssets
  • maxDeposit/previewDeposit/deposit
  • MaxMint / previewMint / mint
  • MaxWithdraw / PreviewWithdraw / withdraw
  • MaxRedeem / previewRedeem / redeem

Events:

  • Deposit
  • Withdraw

1. Asset : Assets is a view function which returns address of the asset token associated with pool

2. totalAsset : totalAssets return the total assets stored into the vault.

3. ConvertToShare : This function returns the number of shares that the vault would swap for the specified number of assets.

4. ConvertToAsset : This method returns the quantity of assets that the vault would trade for the specified number of shares.

5. MaxDeposit : The maximum number of underlying assets that can be deposited by the receiver in a single deposit call is returned by this function.

6. PreviewDeposit : Users can simulate the impact of their deposit at the present block using this tool.

7. Deposit : This process transfers ownership of shares to the receiver and secures the assets of the underlying tokens in the vault.

8. MaxMint : The maximum number of shares that can be issued by the receiver in a single mint call is returned by this function.

9. PreviewMint : Users can simulate the impacts of their mint at the current block using this function.

10. Mint : By depositing assets from underlying tokens, this function mints exact shares of the vault to the recipient.

11. MaxWithdraw : The maximum amount of underlying assets that can be taken out of the owner’s balance in a single withdrawal call is returned by this function.

12. PreviewWithdraw : Users can mimic the impact of their withdrawal at the present block using this tool.

13. Withdraw : This function burns shares owned by the owner and sends the recipient exactly the assets token from the vault.

14. MaxRedeem : The maximum number of shares that can be purchased with a redeem call from the owner balance is returned by this function.

15. PreviewRedeem : Users can simulate the results of their redemption at the present block using this function.

16. Redeem : This process buys back a certain number of shares from the shareholder and transfers the assets of the underlying token from the vault to the recipient.

Events:

1.Deposit : When tokens are deposited into the vault through the mint and deposit methods, they MUST be emitted.

2. Withdraw : When shares are withdrawn from the vault by a depositor using the redeem or withdraw methods, a signal MUST be released.

To implement the ERC-2646 standards into your application to do this you have to inherit the interface of the ERC-2646 which is mentioned below.

Application where we can implement ERC-4626

Leveraged Trading: Tokenised Vaults can be used to enable leveraged trading strategies. Users can lock their base tokens as collateral in a vault and mint vault tokens representing leveraged positions. These vault tokens can be traded or used for various purposes while the base tokens act as collateral, allowing users to magnify their exposure to the underlying asset.

Decentralised Lending and Borrowing: Tokenised Vaults can facilitate decentralised lending and borrowing platforms. Users can deposit their base tokens as collateral in a vault and mint vault tokens. These vault tokens can then be lent out to borrowers who provide suitable collateral. This mechanism enables peer-to-peer lending and borrowing without the need for intermediaries.

Stablecoin Collateralization: In a stablecoin system, Tokenized Vaults can be used to collateralize the stablecoin with the underlying base token. The base token is locked in a vault, and stable coins are minted against the value of the collateral. This mechanism helps to maintain the stability and backing of the stablecoin by ensuring the presence of sufficient collateral..

There are many advantages of the ERC-4626 standard

  • We get a vault facility associated with the ERC-20 token so it will be more secure to deposit the ERC-20 token into the vault.
  • No need to create a separate adapter for every protocol now we have standardisation for vault creation.
  • Cost will be reduced because the integration process is less time consuming.
  • If any application contains a vault facility then it will be easy to integrate ERC-4626 with a particular application.

Conclusion :

After this lots of discussion we all are aware that the ERC-2646 is a really very good standard that set some standards for the vault related contract.

There may be some points where we have to face some problems with ERC-2646

Like as we know it is just a smart contract which uses some strategy to maximise the profit of the user but sometimes where there will be lots of up and down in the DeFi market in that case this might not be able to gain profit as usual.

References:

Official ERC-4626 (Tokenized Vaults)

Exploring the ERC-4626 Universe

Integrating ERC-4626: A Game-Changer in Tokenized Vaults

--

--

Manmeet

Expertise in Ethereum, Rust and EVM supported chains . Meticulous in auditing projects for security and compliance.