跳至主要内容

協助翻譯本頁面

🌏

由於尚未翻譯,本頁面內容以英文顯示。協助我們翻譯內容。

翻譯本頁面

這裡沒有漏洞!🐛

此頁面未翻譯,目前特意維持英文原文。

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

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 shares
6)
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 share
7)
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.

Further reading

這篇文章對您有幫助嗎?

網站上次更新: 2022年11月29日

使用以太坊

  • 尋找錢包
  • 取得以太幣
  • 去中心化應用程式 (dapp)
  • 第二層
  • 執行節點
  • 穩定幣
  • Stake ETH

生態系統

  • 社群中心
  • 以太坊基金會
  • 以太坊基金會部落格
  • 生態系統支援計畫
  • 以太坊漏洞懸賞計畫
  • 生態系統獎助金計畫
  • 以太坊品牌資產
  • Devcon