Tokens

ERC 4626 Tokenized Vault Standard

written by
Chris Cao
Date Last Updated
January 10, 2023
Download Project Files

ERC4626 is an ERC20 extension that defines single-asset Vaults, one of the core building blocks of DeFi which can be used for things like lending markets, yield aggregators, and more

ERC4626

It is okay if you don’t understand what I just said; I am here to talk about it. This tutorial is an extension of the ERC-20 Token. So I would watch that before you start this tutorial.

Watch and read this video to understand ERC20

ERC 4626 is to standardize the implementation of a standard API for tokenized Vaults. The Vault is an ERC20, but it has an underlying asset that is also an ERC20.

ERC-20 tokens, in combination with ERC4626 standardization, are the building blocks of a lending market. A lending market is a way for people to buy, sell, and loan assets to other people. 

The first part of this tutorial will explain the concepts of  ERC4626 standardization and how it functions as a standard to adhere to. The last part of the tutorial describes the code example of the lending market.

 

ERC4626 TOKENIZED VAULT STANDARD

EIP-4626

What:

It is a standard that unifies yield-bearing Vault use cases. It provides a standard API for depositing and withdrawing a single underlying ERC20 Token and receiving representations of those deposits as shares of the total value at a given exchange rate. Here is Ethereum Explanation

Why:

The purpose of the ERC4626 is to provide a foundation for lending markets, aggregators, and intrinsically interest-bearing tokens to be interoperable across DeFi. Standardizing the foundation of these projects helps mitigate errors with battle-tested code and UX considerations around their use.

Use Cases:

Some of the protocols that can benefit from using this standard are:

  • Yield Aggregators (like Yearn)
  • Lending markets (like Aave and Compound)
  • Staking derivatives (like Lido and RocketPool)
  • …and many more!

How:

The standard defines a way to deposit an asset and, in return, get share tokens representing the amount you deposit. While these assets are deposited, you can earn more underlying tokens due to yield strategies that accrue interest on the pool of assets staked. The shares can then be redeemed for your original asset, and any yield earned.

Deposit: Money or something to store in a contract that can be traded for value

Share (tokens): Virtual Tokens that are gained when you deposit an asset(ERC20)

Vaults are contracts: They aim to accrue yield as you lock in your tokens.

Yield Strategies: Depositing an asset into a pool of money to earn interest on the asset.

Redeem/Withdraw: the method to return the asset to the owner with the redemption of the share (tokens)

Lets talk about an example ERC4626 Vault working with DAI. DAI is the share token that represents MakerDao.

You approve and deposit some DAI into a Vault and receive vDAI in exchange

Over time as your deposit accrues yield, your vDAI’s exchange rate will grow

Later, the vDAI can be withdrawn for actual DAI. Hopefully, more than initially deposited!

vDAI is, therefore, a yield-bearing token.

Yield bearing token: represents fractional ownership of the overall pool of DAI locked in a Vault.

The fractional ownership indicator tokens of a pool are called shares.

ERC4626 aims to standardize how DeFi protocols collect and represent deposits in Vaults so that protocols are more interoperable and can be compared quickly. As a result, a stakeholder can transfer assets to different Vaults using the same overall experience, which improves the user experience in DeFi.

We will examine the methods that the EIP-4626 has standardized and what is essential to understand. After understanding ERC4626, you can build your own DeFi protocol!

ERC4626 Token Base Functionality:

  • Depositing
  • Withdrawing
  • Reading balances
  • Events, preview methods, and max methods

Last thing to note

All of the exchanges have their way of delineating money into an asset. The standardization of ERC-4626 will help each institution define how to transfer value into an asset. Standardization will help the customers understand what is going on and give them confidence that their money is appropriately being used and not rugged. Code verification via white paper is part of your due diligence to ensure your money is being used correctly.

Resources:

ERC4626.info

Vyper-4626

Cairo-4626

EIP-4626-Ethereum

EIP-4626-Explain