IERC4626Custom Interface
The IERC4626Custom interface is a modified version of the ERC-4626 Tokenized Vault Standard. It provides methods to manage deposits, withdrawals, and related metadata for tokenized vaults.
This interface excludes the standard IERC20 and IERC20Metadata (already included in IERC20Full). It focuses on vault-specific functionality.
Functions
Below is an overview of each function defined in the IERC4626Custom interface. Refer to the ERC-4626 specification for additional context on these methods.
asset
function asset() external view returns (address assetTokenAddress);
Returns the address of the underlying token used for the Vault (an ERC-20 token contract).
Returns
| Type | Description |
|---|---|
| address | The address of the underlying asset token contract |
totalAssets
function totalAssets() external view returns (uint256 totalManagedAssets);
Returns the total amount of underlying assets managed by the Vault, including any yield or fees.
Returns
| Type | Description |
|---|---|
| uint256 | The total amount of underlying assets managed by the Vault |
convertToShares
function convertToShares(uint256 assets) external view returns (uint256 shares);
Calculates the number of shares that would be received for a given amount of assets, in an ideal scenario without fees or slippage.
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | Amount of underlying assets to convert |
Returns
| Type | Description |
|---|---|
| uint256 | Amount of Vault shares equivalent |
convertToAssets
function convertToAssets(uint256 shares) external view returns (uint256 assets);
Calculates the amount of assets that would be obtained by redeeming a given number of shares, in an ideal scenario without fees or slippage.
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | Amount of Vault shares to convert |
Returns
| Type | Description |
|---|---|
| uint256 | Underlying assets equivalent |
maxDeposit
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
Returns the maximum amount of underlying assets that can be deposited for a given receiver. If no limit, returns 2**256 - 1.
Parameters
| Name | Type | Description |
|---|---|---|
| receiver | address | Address for which deposit is checked |
Returns
| Type | Description |
|---|---|
| uint256 | Maximum number of assets allowed for receiver |
previewDeposit
function previewDeposit(uint256 assets) external view returns (uint256 shares);
Simulates the effect of depositing assets at the current state, returning the number of shares that would be minted (accounting for any deposit fees).
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | Amount of underlying assets to deposit |
Returns
| Type | Description |
|---|---|
| uint256 | Estimated number of shares to be minted |
deposit
function deposit(uint256 assets, address receiver)
external
payable
returns (uint256 shares);
Mints Vault shares by depositing exactly assets of the underlying tokens for receiver. Emits a Deposit event.
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | Amount of underlying assets to deposit |
| receiver | address | Account to receive the minted shares |
Returns
| Type | Description |
|---|---|
| uint256 | The number of Vault shares minted for receiver |
Important Notes:
- May revert if deposit limit is exceeded or not enough tokens are approved.
- Requires sending native tokens (
assets) withmsg.valueif needed by the implementation.
maxMint
function maxMint(address receiver) external view returns (uint256 maxShares);
Returns the maximum amount of Vault shares that can be minted for receiver. If no limit, returns 2**256 - 1.
Parameters
| Name | Type | Description |
|---|---|---|
| receiver | address | Address for which mint is checked |
Returns
| Type | Description |
|---|---|
| uint256 | Maximum number of shares that can be minted for receiver |
previewMint
function previewMint(uint256 shares) external view returns (uint256 assets);
Simulates the effect of minting shares at the current state, returning the number of underlying assets that would be required (accounting for any deposit fees).
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | Number of Vault shares to mint |
Returns
| Type | Description |
|---|---|
| uint256 | Estimated amount of underlying assets required |
mint
function mint(uint256 shares, address receiver)
external
payable
returns (uint256 assets);
Mints exactly shares of the Vault for receiver by depositing the necessary underlying assets. Emits a Deposit event.
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | Number of Vault shares to mint |
| receiver | address | Account to receive the minted shares |
Returns
| Type | Description |
|---|---|
| uint256 | The amount of underlying assets deposited |
Important Notes:
- May revert if mint limit is exceeded or not enough tokens are approved.
- Requires sending native tokens (
assets) withmsg.valueif needed by the implementation.
maxWithdraw
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
Returns the maximum amount of underlying assets that can be withdrawn from the Vault by owner. If no limit, it might return the full balance or 2**256 - 1.
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | Address whose maximum withdrawal is checked |
Returns
| Type | Description |
|---|---|
| uint256 | Maximum amount of underlying assets withdrawable |
previewWithdraw
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
Simulates the effect of withdrawing assets from the Vault, returning the number of shares that would be burned (accounting for any withdrawal fees).
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | Amount of underlying assets to withdraw |
Returns
| Type | Description |
|---|---|
| uint256 | Number of Vault shares that would be burned |
withdraw
function withdraw(uint256 assets, address receiver, address owner)
external
returns (uint256 shares);
Burns Vault shares from owner to send exactly assets of the underlying tokens to receiver. Emits a Withdraw event.
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | Number of underlying assets to withdraw |
| receiver | address | Address receiving the withdrawn assets |
| owner | address | Address whose Vault shares are burned |
Returns
| Type | Description |
|---|---|
| uint256 | Number of Vault shares burned in the operation |
Important Notes:
- May revert if the withdrawal limit is exceeded or
ownerlacks sufficient shares.
maxRedeem
function maxRedeem(address owner) external view returns (uint256 maxShares);
Returns the maximum number of Vault shares that can be redeemed from owner. If no limit, returns the balance of owner.
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | Address whose maximum redemption is checked |
Returns
| Type | Description |
|---|---|
| uint256 | Maximum shares that can be redeemed by the owner |
previewRedeem
function previewRedeem(uint256 shares) external view returns (uint256 assets);
Simulates the effect of redeeming shares from the Vault, returning the underlying assets that would be received (accounting for any withdrawal fees).
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | Vault shares to redeem |
Returns
| Type | Description |
|---|---|
| uint256 | Amount of underlying assets received |
redeem
function redeem(uint256 shares, address receiver, address owner)
external
returns (uint256 assets);
Burns exactly shares from owner to send the corresponding assets to receiver. Emits a Withdraw event.
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | Number of shares to be redeemed |
| receiver | address | Address receiving the redeemed underlying assets |
| owner | address | Address whose shares are burned |
Returns
| Type | Description |
|---|---|
| uint256 | Amount of underlying assets transferred |
boostYield
function boostYield() external payable;
Allows users (or contracts) to boost the yield of the Vault by depositing additional assets (msg.value). The specific mechanics of how this yield is utilized or distributed may depend on the implementation details in the ShMonad contract.
Important Notes:
msg.valuemust be sent if the implementation expects native token (e.g. Ether on Monad).- May revert if not enough gas or incorrect
msg.valueis provided.
Events
Deposit
event Deposit(
address indexed sender,
address indexed owner,
uint256 assets,
uint256 shares
);
Emitted when a deposit of assets results in shares being minted for owner.
Withdraw
event Withdraw(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
Emitted when a withdrawal of assets burns shares from owner and sends the underlying assets to receiver.
Errors
ERC4626ExceededMaxDeposit
error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max);
Reverted when attempting to deposit more assets than the maximum allowed (max) for the specified receiver.
ERC4626ExceededMaxMint
error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max);
Reverted when attempting to mint more shares than the maximum allowed (max) for the specified receiver.
ERC4626ExceededMaxWithdraw
error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max);
Reverted when attempting to withdraw more assets than the maximum allowed (max) for the specified owner.
ERC4626ExceededMaxRedeem
error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max);
Reverted when attempting to redeem more shares than the maximum allowed (max) for the specified owner.