> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ERC-4626 (erc4626)

> Standard interface for tokenized vaults (EIP-4626). Provides deposit, withdraw, mint, redeem and preview functions for any conforming vault.

Standard interface for tokenized vaults (EIP-4626). Provides deposit, withdraw, mint, redeem and preview functions for any conforming vault.

| Fact | Value |
| - | - |
| Category | Infrastructure and standards |
| Family | none |
| Namespace | none: import its ABI |
| Chains | none recorded |

## What it offers

* **deposit**: Deposit underlying assets, receive vault shares
* **withdraw**: Withdraw by specifying asset amount to receive
* **redeem**: Withdraw by specifying share amount to burn
* **mint**: Mint exact number of shares by depositing required assets
* **previewDeposit**: Preview how many shares a deposit would yield
* **previewWithdraw**: Preview how many shares would be burned for a withdrawal
* **convertToShares**: Convert asset amount to equivalent shares
* **convertToAssets**: Convert share amount to equivalent assets

## Notes

* Standard interface (EIP-4626) - protocols that implement it: sDAI, sfrxETH, pufETH, Yearn V3, sUSDe, Beefy vaults
* deposit/withdraw operate in asset terms; mint/redeem operate in share terms
* preview\* functions account for fees; convert\* are pure exchange rate calculations
* Approve the underlying asset to the vault before calling deposit
* owner parameter in withdraw/redeem allows withdrawal on behalf of another address (requires approval)
* Share price typically increases over time as yield accrues

## Its names in a program

The registry records no deployment: `VaultABI` is an interface, bound to an address the
program is given.

```ts theme={null}
import VaultABI from "./protocols/erc4626/VaultABI.json";

// The contract's address, a `main` argument.
function main(contract: Address) {
  const target = VaultABI.at(contract);
}
```

## ABI

Where a line says what an address it returns is, a program that calls the function through
its namespace calls that contract's methods on the result directly:
`<Namespace>.<Contract>.<function>(...).<method>(...)`. A token's methods are the ERC-20
functions, and its writes are SafeERC20.

### `VaultABI`

`import VaultABI from "./protocols/erc4626/VaultABI.json";`

* `deposit(uint256 assets, address receiver) returns (uint256 shares)`
* `mint(uint256 shares, address receiver) returns (uint256 assets)`
* `withdraw(uint256 assets, address receiver, address owner) returns (uint256 shares)`
* `redeem(uint256 shares, address receiver, address owner) returns (uint256 assets)`
* `totalAssets() view returns (uint256)`
* `convertToShares(uint256 assets) view returns (uint256)`
* `convertToAssets(uint256 shares) view returns (uint256)`
* `previewDeposit(uint256 assets) view returns (uint256)`
* `previewMint(uint256 shares) view returns (uint256)`
* `previewWithdraw(uint256 assets) view returns (uint256)`
* `previewRedeem(uint256 shares) view returns (uint256)`
* `maxDeposit(address receiver) view returns (uint256)`
* `maxMint(address receiver) view returns (uint256)`
* `maxWithdraw(address owner) view returns (uint256)`
* `maxRedeem(address owner) view returns (uint256)`
* `asset() view returns (address)`: the address is a token

## Next steps

* [Protocols](https://docs.eco.com/sauce-sdk/reference/protocols.md): the other protocols, by what they do.
* [Protocols and tokens](https://docs.eco.com/sauce/names.md): calling a contract by its namespace, or through its ABI.
* [Glossary](https://docs.eco.com/sauce/glossary.md): the words these pages use, in plain terms.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.