Professional cross-chain yield aggregation protocol built on ERC7540
MetaVault is a next-generation yield aggregation protocol that enables efficient cross-chain capital allocation through asynchronous deposits and withdrawals. Built on the ERC7540 standard, it provides a secure and modular architecture for managing assets across multiple blockchain networks.
The protocol leverages Superform infrastructure to deposit and withdraw from vaults on other chains, allowing users to access yield opportunities across the DeFi ecosystem from a single interface without having to manage multiple wallets or bridge assets manually.
- Seamless Multi-Chain Operations: Invest and divest across Ethereum, Polygon, Optimism, Base, Arbitrum, and more from a single interface
- Asynchronous Processing: Built on ERC7540 for non-blocking deposit and withdrawal operations
- Bridging Agnostic: Leverages Superform protocol for reliable cross-chain messaging and asset transfers
- Sophisticated Withdrawal Strategy: Three-tier liquidation system that optimizes gas and minimizes slippage
- Prioritized Liquidation Queue: Configurable withdrawal queues for both local and cross-chain vaults
- Risk Management: Circuit breakers and emergency recovery mechanisms to protect user funds
- Performance Fee with High Watermark: Only charge performance fees on new profits
- Hurdle Rate Implementation: Performance fees only apply above minimum return thresholds
- Time-Weighted Management Fees: Fairly calculated based on duration of asset custody
- Customizable Fee Exemptions: Special rates for strategic partners or institutional clients
- Modular Proxy Architecture: Upgradeable components for continuous improvement
- Cross-Chain Recovery System: Dedicated recovery contracts for handling failed bridge transactions
- Emergency Shutdown: Circuit breakers to pause operations during extreme market conditions
MetaVault employs a modular architecture with specialized components. Both the MetaVault and SuperformGateway contracts use a simplified version of the diamond proxy pattern called MultiFacet proxy, which allows for modular functionality and upgradeability.
graph TD
Users[Users] -->|Deposit/Redeem| MetaVault[MetaVault]
subgraph Core Protocol
MetaVault -->|Redemption Processing| Engine[ERC7540Engine]
MetaVault -->|Asset Management| AssetsManager[AssetsManager]
MetaVault -->|Cross-chain Operations| Gateway[SuperformGateway]
MetaVault -->|Emergency Recovery| Emergency[EmergencyAssetsManager]
MetaVault -->|Analytics| Reader[MetaVaultReader]
end
subgraph Cross-Chain Infrastructure
Gateway -->|Asset Bridging| Superform[Superform Router]
Gateway -->|Position Tracking| Superpositions[SuperPositions ERC1155]
Gateway -->|Failed Transaction Recovery| Receivers[ERC20Receivers]
Gateway -->|Cross-Chain Recovery| SPR[SuperPositionsReceiver]
end
subgraph Yield Sources
MetaVault --> LocalVaults[Same-Chain Vaults]
MetaVault --> RemoteVaults[Cross-Chain Vaults]
end
subgraph Oracle System
MetaVault -->|Share Price Verification| PriceOracles[Share Price Oracles]
MetaVault -->|Performance Benchmarks| HurdleOracle[Hurdle Rate Oracle]
end
- User deposits assets into MetaVault
- User receives vault shares that represent their proportional ownership
- Protocol manager allocates capital to various yield sources
- Capital can be deployed across same-chain or cross-chain vaults based on yield opportunities
sequenceDiagram
participant User
participant MetaVault
participant Engine as ERC7540Engine
participant Gateway as SuperformGateway
User->>MetaVault: Request Withdrawal
MetaVault->>User: Acknowledge Request
Note over MetaVault,Engine: Redemption Execution
User->>Engine: Process Redemption (or Relayer)
Engine->>Engine: Check Idle Liquidity
alt Sufficient Idle Funds
Engine->>MetaVault: Fulfill From Idle
MetaVault->>User: Transfer Assets
else Insufficient Idle Funds
Engine->>Engine: Liquidate Local Vaults
alt Local Vaults Sufficient
Engine->>MetaVault: Fulfill From Local Vaults
MetaVault->>User: Transfer Assets
else Need Cross-chain Liquidation
Engine->>Gateway: Initiate Cross-chain Withdrawal
Gateway->>Superform: Bridge Request
Gateway->>Engine: Notify When Complete
Engine->>MetaVault: Fulfill Request
MetaVault->>User: Transfer Assets
end
end
The protocol is built around four main contract systems:
-
MetaVault and its modules
MetaVault.sol: Main vault contract implementing ERC7540 for asynchronous operationsERC7540Engine.sol: Processes redemption requests and manages withdrawal strategiesAssetsManager.sol: Manages asset allocation and interaction with underlying vaultsEmergencyAssetsManager.sol: Provides emergency recovery functionsMetaVaultReader.sol: Offers analytics and reporting functions
-
SuperformGateway and its modules
SuperformGateway.sol: Handles cross-chain communication and asset transfersInvestSuperform.sol: Manages cross-chain deposit operationsDivestSuperform.sol: Manages cross-chain withdrawal operationsLiquidateSuperform.sol: Manages cross-chain redemption operations
-
Recovery Contracts
ERC20Receiver.sol: Receives and manages assets during cross-chain operationsSuperPositionsReceiver.sol: Recovers stuck assets from failed cross-chain operations
-
External Protocol Integration
- Uses Superform Router for cross-chain message passing
- Uses SuperPositions (ERC1155) for tracking cross-chain positions
- Custom Share Price Oracle system to track and verify the price of shares (SuperPositions) owned by MetaVault across different chains
- Annual rate applied to total assets under management
- Pro-rated based on time assets are held in vault
- Configurable rate with admin controls
- Applied only to profits above the high watermark
- Subject to hurdle rate (minimum performance threshold)
- Only charged on excess returns above the hurdle rate
- Covers cost of cross-chain price oracle operations
- Network-specific rates to account for varying gas costs
- Proportional to duration of asset custody
To install Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryupTo install Soldeer:
cargo install soldeergit clone https://github.com/VerisLabs/MetaVault.git
cd metavault
soldeer installforge build# Set test environment
export FOUNDRY_PROFILE=fork
# Run all tests
forge test
# Run specific test file
forge test --match-path test/MetaVault.t.sol
# Run with gas reporting
forge test --gas-reportMetaVault can be deployed to various networks using the deployment scripts in the script directory.
Do NOT add your private key to .env or commit it to version control.
Instead, create a secure wallet keystore and use it with Foundry's cast and forge tools.
Credits to Patrick Collins
cast wallet import myKeystoreName --interactive- Enter your wallet's private key when prompted.
- Provide a password to encrypt the keystore file.
⚠️ Recommendation:
Do not use a private key associated with real funds. Create a new wallet for deployment and testing.
Use the keystore you created to sign transactions with forge script:
forge script script/base/01_Deploy.s.sol \
--rpc-url $RPC_BASE \
--broadcast \
--verify \
--account myKeystoreName \
--sender <accountAddress>--account myKeystoreName: Use the keystore you created.--sender <accountAddress>: The address corresponding to your keystore.
Environment variables needed for deployment:
ADMIN_AND_OWNER_ROLE: Address to receive admin and owner rolesRELAYER_ROLE: Address to receive relayer roleEMERGENCY_ADMIN_ROLE: Address to receive emergency admin roleMANAGER_ADDRESS_ROLE: Address to receive manager roleHURDLE_RATE_ORACLE_ADDRESS: Address of the hurdle rate oracle- `RPC_MAINNET: The RPC from the chain u want to deploy the contracts to and from the chains u want to bridge into
- All other RPCs you want to use for multichain invests/divests
This project is licensed under dual licenses:
- Core contracts: UNLICENSED (Proprietary) - See LICENSE
- Applies to core protocol functionality
- Helper libraries and interfaces: MIT License - See MIT_LICENSE