Architecture
This document describes the technical architecture of Unbound’s delta-neutral vault.System Overview
Smart Contracts
Vault Contract (vault.cairo)
ERC-4626 tokenized vault with queue system:
Storage:
Backend Services
DepositProcessor (deposit_processor.py)
Polls vault for pending deposits every 30 seconds:
- Reads deposit queue from contract
- For each unprocessed deposit:
- Calls
process_deposits()(mints shares, transfers USDC) - Deposits USDC to Extended
- Opens SHORT position
- Calls
WithdrawalProcessor (withdrawal_processor.py)
Polls vault for pending withdrawals every 30 seconds:
- Detects PENDING withdrawals
- Calculates USDC value of shares
- Closes proportional position on Extended
- Requests USDC withdrawal from Extended
- Calls
mark_withdrawal_ready()when USDC arrives
PositionManager (position_manager.py)
Monitors position health every 60 seconds:
- Checks funding rate
- Closes positions if funding < -0.01%
- Reopens when funding recovers
- Monitors margin ratio for liquidation risk
NAVReporter (nav_reporter.py)
Reports NAV to vault periodically:
- Calculates: wBTC value + Extended equity
- Signs NAV update
- Submits to vault contract
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/status | GET | Vault status, NAV, delta |
/api/apy | GET | Funding rate and APY estimates |
/api/position | GET | Current short position details |
/api/queues/status | GET | Deposit/withdrawal queue status |
/api/funding-history | GET | Historical funding payments |
External Integrations
Extended Exchange
Perpetual futures on Starknet:- Deposit contract:
0x062da0780fae... - Funding payments every hour
- Formula:
Position × Price × Rate
AVNU Router
DEX aggregator for swaps:- Address:
0x04270219d365d6... - Used for wBTC ↔ USDC swaps on deposit/withdrawal
Data Flow
Deposit
Yield Generation
Withdrawal
Security Model
| Component | Trust Model |
|---|---|
| Vault Contract | Trustless (on-chain, verified) |
| Operator Backend | Trust to run strategy, cannot steal funds |
| Extended Exchange | Custody risk for USDC collateral |
| AVNU Swaps | Trustless (atomic, slippage protected) |
