General ERC-4626 Vault Interface

Generic interface for ERC-4626 vaults.

Contract Interface

Events

Deposit

event Deposit(address sender, address receiver, uint256 assets, uint256 shares)

Withdraw

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

Functions

asset

function asset() external view returns (address assetTokenAddress)

The address of the underlying token used by the Vault for valuing, depositing, and withdrawing.

totalAssets

function totalAssets() external view returns (uint256 totalManagedAssets)

Total amount of the underlying asset that is “managed” by vault.

convertToShares

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

The amount of shares that the Vault would exchange for the amount of assets provided, in an ideal scenario where all the conditions are met.

Parameters

Return Values

convertToAssets

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

The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.

Parameters

Return Values

maxDeposit

function maxDeposit(address caller) external view returns (uint256 maxAssets)

The maximum number of underlying assets that caller can deposit.

Parameters

Return Values

previewDeposit

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

Allows an on-chain or off-chain user to simulate the effects of their deposit at the current transaction, given current on-chain conditions.

Parameters

Return Values

deposit

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

Mint vault shares to receiver by transferring exact amount of underlying asset tokens from the caller.

Parameters

Return Values

maxMint

function maxMint(address caller) external view returns (uint256 maxShares)

The maximum number of vault shares that caller can mint.

Parameters

Return Values

previewMint

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

Allows an on-chain or off-chain user to simulate the effects of their mint at the current transaction, given current on-chain conditions.

Parameters

Return Values

mint

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

Mint exact amount of vault shares to the receiver by transferring enough underlying asset tokens from the caller.

Parameters

Return Values

maxWithdraw

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

The maximum number of underlying assets that owner can withdraw.

Parameters

Return Values

previewWithdraw

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

Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current transaction, given current on-chain conditions.

Parameters

Return Values

withdraw

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

Burns enough vault shares from owner and transfers the exact amount of underlying asset tokens to the receiver.

Parameters

Return Values

maxRedeem

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

The maximum number of shares an owner can redeem for underlying assets.

Parameters

Return Values

previewRedeem

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

Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current transaction, given current on-chain conditions.

Parameters

Return Values

redeem

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

Burns exact amount of vault shares from owner and transfers the underlying asset tokens to the receiver.

Parameters

Return Values

Last updated