Core Operations
MetaVault core operations consist of four main categories:
Deposit Operations (atomic via multicall)
Withdrawal Operations (4-step process)
Investment Operations (same and cross-chain)
Divestment Operations (same and cross-chain)
Deposit Operations
Atomic Deposit (via Multicall)
requestDeposit
First step of atomic deposit process.
Requirements:
Vault not in emergency shutdown
Assets approved for transfer
Asset amount non-zero
deposit
Second step of atomic deposit process.
Events:
Deposit(controller, to, assets, shares)
Withdrawal Operations
Step 1: Request Redemption
Process:
Verify share lock status
Create pendingRedeemRequest
Transfer shares to vault
Set redeemLocked[controller] = true
Step 2: Process Request (via Relayer)
Process:
Check totalIdle() first
If insufficient idle assets, calculate divest route
Process withdrawals through ERC7540Engine
Update pending to claimable state
Step 3: Settlement
OR
Process:
Receive assets from cross-chain operations
Move from pendingRedeemRequest to claimableRedeemRequest
Update vault accounting
Step 4: Final Redemption
Process:
Verify redeemLocked[controller] = false
Check claimableRedeemRequest
Process redemption
Clear claimable state
Investment Operations
Direct Investment (Same Chain)
investSingleDirectSingleVault
Process Flow:
Validate vault in approved list
Record initial balance for share calculation
Deposit assets into target vault
Verify received shares meet minimum
Update accounting:
Decrease _totalIdle
Increase _totalDebt
Update vault's totalDebt
Emit
Invest
event
Example:
Cross-Chain Investments
investSingleXChainSingleVault
Process Flow:
Gateway validation
Asset transfer to gateway
Initiate cross-chain deposit
Track pending investments
Update vault accounting
Example:
investMultiXChainMultiVault
Process Flow:
Multi-chain validation
Calculate total investment
Asset transfer to gateway
Track individual vault investments
Update global debt tracking
Example:
Divestment Operations
Direct Divestment
divestSingleDirectSingleVault
Process Flow:
Calculate share value
Check if full withdrawal
Redeem from target vault
Verify minimum assets received
Update accounting:
Increase _totalIdle
Decrease _totalDebt
Update vault's totalDebt
Emit
Divest
event
Example:
Cross-Chain Divestments
divestSingleXChainSingleVault
Process Flow:
Transfer NFTs to gateway
Update debt tracking
Initiate cross-chain withdrawal
Track pending divest
Wait for settlement
Example:
divestMultiXChainMultiVault
Process Flow:
Process multiple vaults per chain
Batch NFT transfers
Update debt per vault
Track cross-chain operations
Emit events per chain
Important Considerations:
Gas estimation per chain
Bridge timeouts
Slippage protection
Settlement verification
Example:
Last updated