Architecture

Component Overview

1. MetaVault (Core Vault)

  • Primary user-facing contract

  • Manages deposits and withdrawals

  • Handles fee calculations

  • Controls investment strategies

Key Responsibilities:

// Asset Management
function totalAssets() public view returns (uint256)
function totalDeposits() public view returns (uint256)
function totalWithdrawableAssets() public view returns (uint256)

// Investment Control
function investSingleDirectSingleVault(...)
function investMultiXChainMultiVault(...)

2. ERC7540Engine (Async Operations)

  • Handles asynchronous operations

  • Manages withdrawal queues

  • Processes redemption requests

  • Calculates optimal routes

Core Functions:

function processRedeemRequest(
    address controller,
    SingleXChainSingleVaultWithdraw calldata sXsV,
    SingleXChainMultiVaultWithdraw calldata sXmV,
    MultiXChainSingleVaultWithdraw calldata mXsV,
    MultiXChainMultiVaultWithdraw calldata mXmV
) external payable

3. SuperformGateway (Cross-chain Bridge)

  • Manages cross-chain communication

  • Handles token bridging

  • Processes cross-chain settlements

  • Maintains receiver contracts

Key Features:

function investSingleXChainSingleVault(...)
function divestSingleXChainSingleVault(...)
function settleLiquidation(...)

State Transitions

1. Deposit Flow

2. Cross-chain Investment Flow

3. Withdrawal Flow

Type Definitions

VaultData

struct VaultData {
    uint16 deductedFees;        // Fees already deducted
    uint64 chainId;             // Vault chain location
    uint192 lastReportedSharePrice; // Latest price
    uint256 superformId;        // Unique identifier
    ISharePriceOracle oracle;   // Price oracle
    uint8 decimals;            // Token decimals
    uint128 totalDebt;         // Total allocated
    address vaultAddress;      // Vault location
}

VaultConfig

struct VaultConfig {
    address asset;              // Underlying token
    string name;               // Vault name
    string symbol;             // Vault symbol
    uint16 managementFee;      // Annual fee
    uint16 performanceFee;     // Success fee
    uint16 oracleFee;         // Update reward
    uint16 assetHurdleRate;    // Min performance
    uint24 sharesLockTime;     // Lock period
    uint24 processRedeemSettlement; // Settlement delay
    ISuperPositions superPositions; // NFT handler
    address treasury;          // Fee recipient
    address recoveryAddress;   // Emergency backup
    address signerRelayer;     // Auth handler
}

State Management

Accounting States

uint128 internal _totalIdle;    // Unallocated assets
uint128 internal _totalDebt;    // Allocated assets
uint256 public sharePriceWaterMark; // ATH price

Cross-chain States

uint256 public totalpendingXChainInvests;
mapping(uint256 => uint256) public pendingXChainInvests;
uint256 public totalPendingXChainDivests;

Last updated