Introduction

MetaVault Overview

Introduction

MetaVault is a sophisticated ERC7540 implementation enabling cross-chain yield aggregation through integration with the Superform protocol. The vault manages assets across multiple blockchain networks while providing advanced performance tracking, fee distribution systems, and robust risk management controls.

Key Features

  • Cross-Chain Asset Management

    • Integration with 7 major blockchain networks

    • Asynchronous request-based operations

    • Secure cross-chain messaging via Superform protocol

  • Advanced Fee System

    • Performance-based fee calculation

    • Management fee distribution

    • Oracle reward mechanism

    • High watermark tracking

  • Security Controls

    • Multi-layer access control

    • Emergency shutdown capability

    • Share locking mechanism

    • Slippage protection

  • Oracle Integration

    • Price tracking across chains

    • Performance monitoring

    • Yield optimization

Technical Specifications

Inheritance

contract MetaVault is MultiFacetProxy, Multicallable

Dependencies

import { ERC4626 } from "solady/tokens/ERC4626.sol";
import { FixedPointMathLib as Math } from "solady/utils/FixedPointMathLib.sol";
import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol";

Libraries

using SafeCastLib for uint256;
using SafeTransferLib for address;
using VaultLib for VaultData;
using Math for uint256;

Architecture

State Variables

Constants

uint256 public constant WITHDRAWAL_QUEUE_SIZE = 30;
uint256 public constant SECS_PER_YEAR = 31_556_952;
uint256 public constant MAX_BPS = 10_000;
uint24 public constant REQUEST_REDEEM_DELAY = 1 days;

Core Storage

uint128 internal _totalIdle;        // Unallocated assets
uint128 internal _totalDebt;        // Total allocated assets
uint256 public sharePriceWaterMark; // High watermark for fees
address public treasury;            // Fee receiver
address public recoveryAddress;     // Emergency recovery
ISuperformGateway public gateway;   // Cross-chain gateway

Access Control

Roles

uint256 public constant ADMIN_ROLE = _ROLE_0;
uint256 public constant EMERGENCY_ADMIN_ROLE = _ROLE_1;
uint256 public constant ORACLE_ROLE = _ROLE_2;
uint256 public constant MANAGER_ROLE = _ROLE_3;
uint256 public constant RELAYER_ROLE = _ROLE_4;

Role Permissions

  • ADMIN_ROLE: Contract configuration and vault management

  • EMERGENCY_ADMIN_ROLE: Emergency controls and risk management

  • ORACLE_ROLE: Price updates and performance tracking

  • MANAGER_ROLE: Investment and divestment operations

  • RELAYER_ROLE: Cross-chain message handling

Supported Networks

uint64[N_CHAINS] public DST_CHAINS = [
    1,      // Ethereum Mainnet
    137,    // Polygon
    56,     // BNB Chain
    10,     // Optimism
    8453,   // Base
    42161,  // Arbitrum One
    43114   // Avalanche
];

Quick Reference

Operation Matrix

Operation
Same Chain
Cross-Chain
Multi-chain

Deposit

requestDeposit

-

-

Investment

investSingleDirectSingleVault

investSingleXChainSingleVault

divestSingleXChainSingleVault

Divestment

divestSingleDirectSingleVault

divestSingleXChainSingleVault

divestMultiXChainMultiVault

Withdrawal

requestRedeem

-

-

Common Flows

Deposit Flow

  1. requestDeposit: Initiates deposit request

  2. deposit: Processes deposit → See Deposit Section

  3. _afterDeposit: Post-deposit processing

Investment Flow

  1. Single Chain: investSingleDirectSingleVault → See Investment Section

  2. Cross Chain: investSingleXChainSingleVault → See Cross-Chain Section

Withdrawal Flow

  1. requestRedeem: Initiates withdrawal → See Withdrawal Section

  2. redeem: Processes redemption

  3. withdraw: Completes withdrawal

Last updated