ERC-4626 is a standard for tokenized Vaults with a single underlying ERC-20 token. Note there is only a single asset in the deposit and withdraw functions.
IERC4626Vault Solidity interface.
The vaults follow the Open Zeppelin pattern of all the external functions calling an internal function that can be overridden by implementing contracts. For example, the external deposit
function calls the internal, virtual _deposit
function that can be overridden with inheritance.
AbstractVault implements the IERC4626Vault interface with Pausable flow methods - deposit, mint, redeem and withdraw.
The following functions need to be implemented:
totalAssets
that returns the total amount of the underlying assets that is managed by vault._afterDepositHook
called after assets have been transferred into the vault but before shares are minted. Typically, this deposits the assets into the underlying vaults or platforms._beforeWithdrawHook
called before shares are burnt and assets are transferred to the receiver. Typically, this withdraws the assets from the underlying vaults or platforms.
AbstractVault
hierarchy
AbstractVault
contract
LightAbstractVault is a minimal abstract implementation of an ERC-4626 vault.
LightAbstractVault
hierarchy
LightAbstractVault
contract
- Asset Allocation Vaults allocates assets in a multi asset vault.
- Fee Vaults collect various fees for multiple parties. For example, transaction, performance and management fees.
- Liquidator is responsible for collecting reward tokens from vaults, swapping them and donating back the purchased tokens to the vaults.
- Liquidity Vaults provide liquidity to Automated Market Makers (AMM) to earn yield. For example, Uniswap, Curve or Convex.
- Swap Vaults can swap underlying assets in a Meta Vault. This is used for rebalancing a vault's underlying assets. Swaps can be done via aggregators like 1Inch or AMMs like Uniswap.
- Meta Vaults vaults that invest in underlying ERC-4626 vaults.
Note: All vaults have deposit, mint, redeem, withdraw as pausable.