Skip to content

Repository files navigation

Adaptive Yield

Risk-aware ERC-4626 yield optimization infrastructure for USDC on Base.

Adaptive Yield is an experimental single-asset vault that separates yield intelligence from custody. An off-chain system may recommend allocations, but the public contracts enforce the strategy allowlist, exposure caps, idle liquidity, execution slippage, timing, role boundaries, and emergency controls.

Advertised APY is not safe net yield. A 12% opportunity can be economically worse than a 6% opportunity after liquidity constraints, protocol and smart-contract risk, gas, slippage, concentration, and unsustainable incentives. The long-term objective is to maximize expected net risk-adjusted return—not the largest displayed APY.

Experimental and unaudited. Not production-ready, financial advice, or an investment recommendation. No real-money deployment has been performed. Use at your own risk.

Status

Capability Status
ERC-4626 USDC vault and virtual-share inflation defense ✅ Implemented
Role separation, deposit cap, pause, and emergency recall ✅ Implemented
Strategy allowlist, percentage exposure caps, and bounded iteration ✅ Implemented
Idle-liquidity floor, execution slippage, and anti-churn interval ✅ Implemented
Aave V3 supply-only adapter 🧪 Base mainnet-fork tested
Generic ERC-4626 / Morpho adapter 🧪 Base mainnet-fork tested
Unit, fuzz, adversarial, and stateful invariant tests ✅ Implemented
Private yield-intelligence engine and backtesting 📋 Planned
Audit or production deployment 📋 Not performed

Architecture

flowchart TD
    U["Users"] --> V["AdaptiveYieldVault (ERC-4626)"]
    V --> I["Idle USDC"]
    V --> A["AaveV3Strategy"]
    V --> M["ERC4626Strategy"]
    A --> AP["Aave V3 on Base"]
    M --> MP["Approved Morpho ERC-4626 vault"]
    E["Future private yield-intelligence engine"] -. "allocation recommendation" .-> R["Constrained rebalancer account"]
    R --> V
Loading

The rebalancer cannot transfer underlying to an arbitrary address or execute arbitrary calldata. It can only deposit into and withdraw from governance-approved strategies. Every deposit is checked against the strategy cap, configured idle floor, protocol capacity, and caller-provided minimum position increase. Withdrawals measure actual assets received. The vault holds at most eight strategies and executes at most sixteen instructions per rebalance.

Security model

  • OpenZeppelin ERC-4626 with a configurable decimals offset (deployment default: 3) creates virtual shares/assets that make first-depositor donation attacks economically loss-making; an adversarial test exercises the attack.
  • DEFAULT_ADMIN_ROLE, MANAGER_ROLE, REBALANCER_ROLE, and GUARDIAN_ROLE separate governance, configuration, allocation, and incident response.
  • Deposits and rebalances pause; user withdrawals remain available when liquidity exists.
  • Exact balance-delta checks reject fee-on-transfer underlying behavior. V0.2 assumes a standard, non-rebasing, non-fee-on-transfer ERC-20.
  • Temporary exact allowances are cleared after strategy calls. Reentrancy guards cover user flows and rebalances.
  • Underlying USDC cannot be rescued. Unrelated accidentally transferred tokens can be recovered by the manager.
  • No leverage, borrowing, swaps, price oracles, arbitrary-call executor, proxy, fees, or protocol token exists.

Governance-approved strategies remain trusted valuation adapters. A malicious strategy can lie about NAV or lose capital, and compromised governance can approve one. External protocols, USDC, Base, and role keys remain trust/risk boundaries. See Threat Model.

Quick start

Requirements: Foundry and Git.

make install
make fmt-check
make build
make test

Base fork tests are separate and read-only with respect to mainnet:

export BASE_RPC_URL="https://your-base-rpc.example"
make test-fork

The fork fixture is pinned to block 50,123,005. The selected Morpho vault is only an integration-test target, not an investment recommendation. No private key is needed for tests.

Repository map

  • src/AdaptiveYieldVault.sol — vault accounting, liquidity recall, roles, and risk constraints.
  • src/strategies/ — shared adapter safety, Aave V3, and reusable ERC-4626 integration.
  • src/config/ — verified network-specific fork/deployment targets.
  • test/ — unit, fuzz, adversarial, invariant, and opt-in fork coverage.
  • script/ — guarded Foundry deployment scaffold; Base mainnet broadcasting is disabled by default.
  • docs/ — architecture, economics, integrations, testing, threat model, roadmap, and ADRs.

Design boundary

The future private engine may ingest market data, estimate net yield and risk, backtest policies, and submit allocation recommendations through a rebalancer key. It is not required to understand the vault's custody properties: all critical asset-destination and risk constraints are public and on-chain. Example public data contracts are documented in Economics.

Documentation

Licensed under the MIT License. The license applies to this public protocol repository, not to any future private intelligence engine or proprietary datasets.

About

Risk-aware ERC-4626 yield optimizer for USDC on Base with constrained rebalancing and fork-tested DeFi integrations.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages