Skip to main content

IERC4626Custom Interface

The IERC4626Custom interface is based on the ERC-4626 "Tokenized Vault Standard" with modifications specific to shMONAD's requirements. This interface defines the core functionality for depositing MON and receiving shMON tokens.

Events

Deposit

event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

Emitted when assets are deposited into the vault.

Withdraw

event Withdraw(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);

Emitted when assets are withdrawn from the vault.

Asset Management

asset

function asset() external view returns (address assetTokenAddress);

Returns the address of the underlying token used for the Vault.

Returns

TypeDescription
addressThe address of the underlying asset token

totalAssets

function totalAssets() external view returns (uint256 totalManagedAssets);

Returns the total amount of the underlying asset managed by the Vault.

Returns

TypeDescription
uint256Total amount of underlying assets

Conversion Functions

convertToShares

function convertToShares(uint256 assets) external view returns (uint256 shares);

Calculate how many shares would be received for a given amount of assets.

Parameters

NameTypeDescription
assetsuint256The amount of assets to convert

Returns

TypeDescription
uint256The amount of shares that would be received

convertToAssets

function convertToAssets(uint256 shares) external view returns (uint256 assets);

Calculate how many assets would be received for a given amount of shares.

Deposit Operations

deposit

function deposit(uint256 assets, address receiver) external payable returns (uint256 shares);

Deposit assets and receive shares.

Parameters

NameTypeDescription
assetsuint256The amount of assets to deposit
receiveraddressThe receiver of the shares

Returns

TypeDescription
uint256The amount of shares minted

mint

function mint(uint256 shares, address receiver) external payable returns (uint256 assets);

Mint exact amount of shares by depositing assets.

Withdrawal Operations

withdraw

function withdraw(
uint256 assets,
address receiver,
address owner
) external returns (uint256 shares);

Withdraw exact amount of assets.

Parameters

NameTypeDescription
assetsuint256The amount of assets to withdraw
receiveraddressThe receiver of the assets
owneraddressThe owner of the shares

redeem

function redeem(
uint256 shares,
address receiver,
address owner
) external returns (uint256 assets);

Redeem shares for assets.

Preview Functions

previewDeposit

function previewDeposit(uint256 assets) external view returns (uint256 shares);

Preview how many shares would be received for a deposit.

previewMint

function previewMint(uint256 shares) external view returns (uint256 assets);

Preview how many assets would be needed for a mint.

previewWithdraw

function previewWithdraw(uint256 assets) external view returns (uint256 shares);

Preview how many shares would be burned for a withdrawal.

previewRedeem

function previewRedeem(uint256 shares) external view returns (uint256 assets);

Preview how many assets would be received for a redemption.

Maximum Limits

maxDeposit

function maxDeposit(address receiver) external view returns (uint256 maxAssets);

Get the maximum amount that can be deposited.

maxMint

function maxMint(address receiver) external view returns (uint256 maxShares);

Get the maximum amount of shares that can be minted.

maxWithdraw

function maxWithdraw(address owner) external view returns (uint256 maxAssets);

Get the maximum amount that can be withdrawn.

maxRedeem

function maxRedeem(address owner) external view returns (uint256 maxShares);

Get the maximum amount of shares that can be redeemed.

Custom Errors

error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max);
error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max);
error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max);
error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max);

Errors thrown when operation limits are exceeded.