For the complete documentation index, see llms.txt. This page is also available as Markdown.

Developers

Technical architecture and smart contract details for high yield vaults.

High Yield Vaults are built on the ERC-4626 tokenized vault standard with a modular architecture that enables automated looping, risk management, and withdrawals.

The system minimizes custom logic by composing audited protocol components with Superlend-specific automation.


Architecture Overview

High Yield Vaults integrate the following modules:

  • Flash Loans – atomic looping and unlooping execution

  • Universal DEX Module – token swaps during looping and withdrawals

  • Withdraw Manager – queued and scheduled withdrawals

  • Accountant Module – NAV calculation and fee accounting

  • Rebalancing Engine – maintains healthy leverage and target parameters

All components are orchestrated by the vault contract and executed onchain.


Core Components

  • SuperloopVault ERC-4626 vault implementation with supply caps and performance fees.

  • SuperloopActions Executes modular strategy actions during loop, unloop, and rebalance operations.

  • SuperloopBase Handles roles, permissions, and administrative controls.

  • Aave V3 Modules Supply, Borrow, Withdraw, Repay, and E-Mode integrations.

  • Flashloan Module Uses Aave V3 flash loans with callback handling.

  • Universal DEX Module Executes swaps internally or via external liquidity sources.

  • AccountantAaveV3 Calculates total assets, profits, and performance fees.

  • WithdrawManager Queues and resolves scheduled withdrawals.

  • VaultRouter Enables token-agnostic deposits by swapping into the vault’s base asset.


Deployment & Initialization

High Yield Vaults are deployed behind a TransparentUpgradeableProxy and initialized using DataTypes.VaultInitData.

Initialization includes:

  • Base asset, name, and symbol

  • Supply cap

  • Module registry and strategy modules

  • Accountant and withdraw manager modules

  • Admin addresses (vault admin, treasury)

After initialization:

  • Modules and callback handlers are registered

  • Accountant and withdraw manager are set via admin functions


Roles & Permissions

  • Vault Admin Can update supply caps, module registry, parameters, and treasury.

  • Privileged Addresses Allowed to transfer shares under guarded conditions.

  • Modules Restricted to execution within a valid vault execution context.

  • WithdrawManager Callable only by the vault during withdrawal resolution.


Module Execution Flow

Strategy execution uses Superloop.operate(DataTypes.ModuleExecutionData[]):

  1. Start execution context

  2. Execute each module action (CALL / DELEGATECALL)

  3. End execution context

operateSelf is used for internal calls during execution (e.g. flash loan callbacks).


Flash Loan Flow

  1. Flash loan triggered via flashLoanSimple

  2. Callback routed to a registered handler using (msg.sender, msg.sig)

  3. Handler processes approvals, repayments, and optional re-entry into operateSelf

This enables atomic looping and deleveraging.


Withdrawals

  • Instant Withdrawals Uses instantWithdrawModule (if available) to redeem shares directly.

  • Scheduled Withdrawals Requests are queued in WithdrawManager. The vault unwinds leveraged positions and resolves liquidity before users claim.


VaultRouter (Token-Agnostic Deposits)

  • If tokenIn == vault.asset() → direct deposit

  • Otherwise:

    1. Swap via Universal DEX Module

    2. Approve resulting base asset

    3. Deposit into the vault


Integration Patterns

Common strategy flows include:

  • Initial Looping Flash loan → supply → borrow → swap → repay

  • Leverage Adjustment Repay / withdraw / swap via flash loan to reach target exposure

  • Queued Withdrawals Approve → request → vault unloops → user claims

Last updated