Depositing and Redeeming
MetaVaults follow the ERC-7540 asynchronous vault standard. Unlike standard ERC-4626 vaults where deposits and redeems are instant, MetaVaults use a request → settle → share mint / share burn flow.
Deposit flow
Step 1: Request a deposit
function requestDeposit(
uint256 assets,
address controller,
address owner
) external returns (uint256 requestId)The depositor transfers assets (underlying token, e.g. USDC) to the wrapper. The assets are forwarded to the infrastructure vault.
msg.sender must approve the MetaVaultWrapper to spend the underlying asset before calling requestDeposit.
Requirements:
assets > 0owner == msg.senderormsg.senderis an approved operator ofownerThe vault must not be paused
What happens internally:
If the controller has a claimable deposit from a previous epoch, it is automatically claimed first.
Assets are transferred from
ownerto the wrapper, then forwarded to the infrastructure vault.The request is recorded in the current epoch's deposit request balance.
Step 2: Wait for settlement
The accountant calls settle() on the infrastructure vault to end the current epoch. During settlement:
Pending deposit assets are converted to shares using the epoch's total supply and total assets snapshot.
Shares are minted and made available for claiming.
Step 3: Mint shares
The assets parameter is not used in the MetaVaultWrapper implementation. Calling deposit always mints all claimable shares for the controller.
Requirements:
controller == msg.senderormsg.senderis an approved operator ofcontrollerThe controller must have a claimable deposit from a settled epoch
Returns: The number of wrapper shares minted to receiver.
Complete deposit example
Redeem flow
Step 1: Request a redeem
The depositor's wrapper shares are burned and the equivalent infrastructure vault shares are queued for redemption.
Requirements:
shares > 0owner == msg.senderormsg.senderis an approved operator ofownerThe vault must not be paused
What happens internally:
If the controller has a claimable redeem from a previous epoch, it is automatically claimed first.
Wrapper shares are burned from
owner.The corresponding infrastructure vault shares are queued for redemption.
The request is recorded in the current epoch's redeem request balance.
Step 2: Wait for settlement
During settle(), pending redeem shares are converted to assets using the epoch's snapshot values. Assets are made available for claiming.
Step 3: Burn shares for assets
Like deposit, the shares parameter is not used. Calling redeem always returns all claimable assets for the controller.
Returns: The amount of underlying assets transferred to receiver.
Complete redeem example
Decreasing a request
If a depositor changes their mind before settlement, they can decrease their pending request:
These functions can only be called by the original requester (msg.sender). The refunded assets or shares are returned directly to msg.sender.
Operator model
MetaVaults support the ERC-7540 operator pattern. A controller can approve an operator to act on their behalf:
Once approved, the operator can call requestDeposit, deposit, requestRedeem, and redeem on behalf of the controller.
View functions for integrators
pendingDepositRequest(requestId, controller)
Assets queued in the current epoch
claimableDepositRequest(requestId, controller)
Assets claimable from a settled epoch
pendingRedeemRequest(requestId, controller)
Shares queued in the current epoch
claimableRedeemRequest(requestId, controller)
Shares claimable from a settled epoch
maxDeposit(receiver)
Maximum claimable deposit amount (0 if paused or current epoch)
maxRedeem(owner)
Maximum claimable redeem amount (0 if paused or current epoch)
convertToShares(assets)
Convert assets to shares using the last settled epoch rate
convertToAssets(shares)
Convert shares to assets using the last settled epoch rate
convertToShares(assets, epochId)
Convert using a specific epoch's rate
convertToAssets(shares, epochId)
Convert using a specific epoch's rate
totalAssets()
Estimated total assets of the wrapper
epochId()
Current epoch ID from the infrastructure vault
previewDeposit, previewRedeem, previewWithdraw, and previewMint are not implemented on the MetaVaultWrapper, as specified by ERC-7540 for asynchronous vaults. Calling them will revert.
Last updated