Допоможіть перекласти цю сторінку

🌏

Ця сторінка відображається англійською мовою, оскільки ми ще не переклали її. Допоможіть нам у цьому.

Це не помилка!🐛

Ця сторінка не перекладається. Ми навмисно поки що залишили її англійською.

ERC-4626 Tokenized Vault Standard

Остання зміна: , Invalid DateTime
Змінити сторінку

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

deposit

1function deposit(address _to, uint256 _value) public returns (uint256 _shares)
2
📋 Копіювати

This function deposits the _value tokens into the vault and grants ownership to _to.

withdraw

1function withdraw(address _to, uint256 _value) public returns (uint256 _shares)
2
📋 Копіювати

This function withdraws _value token from the vault and transfers them to _to.

totalHoldings

1function totalHoldings() public view returns (uint256)
2
📋 Копіювати

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

balanceOfUnderlying

1function balanceOfUnderlying(address _owner) public view returns (uint256)
2
📋 Копіювати

This function returns the total amount of underlying tokens held in the vault for _owner.

underlying

1function underlying() public view returns (address)
2
📋 Копіювати

Returns the address of the token the vault uses for accounting, depositing, and withdrawing.

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.

redeem

1function redeem(address _to, uint256 _shares) public returns (uint256 _value)
2
📋 Копіювати

Redeems a specific number of _shares for underlying tokens and transfers them to _to.

exchangeRate

1function exchangeRate() public view returns (uint256)
2
📋 Копіювати

The amount of underlying tokens one baseUnit of vault shares is redeemable for. For example:

1_shares * exchangeRate() / baseUnit() = _value.
2
📋 Копіювати
1exchangeRate() * totalSupply() MUST equal totalHoldings().
2
📋 Копіювати

baseUnit

1function baseUnit() public view returns(uint256)
2
📋 Копіювати

The decimal scalar for vault shares and operations involving exchangeRate().

Events

Deposit Event

MUST be emitted when tokens are deposited into the vault

1event Deposit(address indexed _from, address indexed _to, uint256 _value)
2
📋 Копіювати

Where _from is the user who triggered the deposit and approved _value underlying tokens to the vault, and _to is the user who can withdraw the deposited tokens.

Widthdraw Event

MUST be emitted when tokens are withdrawn from the vault by a depositor.

1event Withdraw(address indexed _owner, address indexed _to, uint256 _value)
2
📋 Копіювати

Where _from is the user who triggered the withdrawal and held _value underlying tokens in the vault, and _to is the user who received the withdrawn tokens.

Note: All batch functions, including the hook, are also available in non-batch versions. This is done to save gas, as transferring just one asset will likely remain to be the most common method. For clarity in the explanations, we've left them out, including the safe transfer rules. Remove the 'Batch' and the names are identical.

Further reading

Was this article helpful?