CORTEX Protocol Documentation
CORTEX is a decentralized, AI-managed investment vault protocol built on Base. Users deposit ETH or USDC, and an autonomous AI agent manages a diversified portfolio across the Base DeFi ecosystem — allocating across lending, liquidity provision, and momentum strategies.
Chain
Base (8453)
Standard
ERC-4626
AI Engine
Claude
License
MIT
How It Works
- 01Deposit — Users deposit ETH or USDC into the CORTEX vault on Base and receive cVault shares proportional to their deposit.
- 02AI Manages — Every 10 minutes, the AI agent analyzes market conditions, sentiment, and risk — then allocates capital across Core, Mid-Risk, and Degen tiers.
- 03Earn Yield — As the AI generates returns, your cVault share value increases. Withdraw anytime with a 0.5% fee.
Architecture
CORTEX is built as a full-stack protocol with on-chain smart contracts, an off-chain AI agent, and a real-time web interface.
System Flow
User deposits ETH/USDC
└─► CortexVault.deposit() → mints cVault shares
│
├─► Cron: /api/cron/snapshot (every 5m)
│ └─► Reads vault state → stores in Supabase
│
├─► Cron: /api/cron/ai-cycle (every 10m)
│ ├─► collector.ts → fetch prices, TVL, sentiment
│ ├─► analyzer.ts → Claude API analysis
│ ├─► guardrails.ts → validate tier bounds, rate limits
│ └─► executor.ts → vault.executeStrategy(target, calldata)
│ ├─► Uniswap V3 (swaps)
│ ├─► Aerodrome (LPs)
│ ├─► Aave V3 (lending)
│ └─► Compound V3 (lending)
│
├─► Cron: /api/cron/indexer (every 5m)
│ └─► Syncs on-chain events → Supabase
│
└─► Frontend reads from Supabase + contract
└─► Real-time updates via Supabase RealtimeFrontend
Next.js 16, React 19, TailwindCSS, Recharts
Contracts
Solidity 0.8.20, Foundry, OpenZeppelin
Database
Supabase (PostgreSQL + Realtime)
AI Engine
Claude API (Anthropic SDK)
DEX Layer
Uniswap V3, Aerodrome, Aave, Compound
Oracle
Chainlink + CoinGecko with fallback
Smart Contracts
All contracts are deployed on Base mainnet and verified. Source code is in the contracts/ directory.
CortexToken
BaseScan0x7A67AFf42d26bDb1A1569C6DE758A4f28e15e4FD
ERC-20 governance token with ERC20Votes and ERC20Permit. Fixed supply of 1,000,000,000 CORTEX.
CortexVault
BaseScan0x3A0799D13c737b341c41004BF9861eBdba28Dcf1
ERC-4626 tokenized vault. Accepts ETH and USDC deposits, issues cVault shares. AI-managed strategy execution with fee accrual.
CortexStaking
BaseScan0x494D4ba8BBe8E9041207A206Cd635af343c9007E
Lock-based staking with time multipliers. Stake CORTEX to earn a share of protocol fees paid in WETH.
CortexGovernor
BaseScan0x11cd3AfcBd99c22B47435DA29E93C26844b8d1Dc
OpenZeppelin Governor with 4% quorum, 3-day voting period, 1-day voting delay, and 24-hour timelock.
Treasury
BaseScan0xd637A73E056Da2f8761474621B4889c96257d3f3
Fee collection and distribution. 50% of all fees go to CORTEX stakers, 50% to the protocol treasury.
Vault (ERC-4626)
The CORTEX Vault follows the ERC-4626 tokenized vault standard. Users deposit assets and receive cVault shares that represent their proportional ownership of the vault.
Fee Structure
Management Fee
Charged on total AUM, accrued continuously
Performance Fee
Charged on net new profits above high-water mark
Withdrawal Fee
Deducted when redeeming cVault shares
Deposit Fee
No fee to deposit into the vault
Allocation Tiers
The AI allocates capital across three governance-controlled tiers. $CORTEX holders vote on the allocation bands.
Core
Low RiskMid-Risk
Medium RiskDegen
High RiskAI Agent
The CORTEX AI agent is an autonomous decision-making system that runs every 10 minutes. It uses Claude (Anthropic) to analyze market conditions and execute portfolio decisions.
Decision Cycle
Fetches real-time prices from Chainlink and CoinGecko, on-chain TVL and volume data, and social sentiment from Farcaster and Twitter.
Sends market data to Claude API with system prompt defining tier rules, risk constraints, and allocation targets. Claude returns a structured decision.
Guardrails check: tier allocation bounds, max trades per hour (20), minimum confidence (60%), max position size, and slippage limits.
Approved trades are encoded as calldata and sent through the vault's executeStrategy() function to the target DEX protocol.
Full reasoning — market summary, sentiment scores, risk assessment, decision, and executed trades — is stored in Supabase for transparency.
Guardrails
Governance
CORTEX is governed by $CORTEX token holders. The protocol uses OpenZeppelin Governor with a timelock for all parameter changes.
Parameters
What Can Be Governed
- Allocation tier bands (Core, Mid-Risk, Degen ranges)
- Fee structure (management, performance, withdrawal)
- Whitelisted protocols and assets
- AI trade rate limits and confidence thresholds
- Max slippage parameters
- Emergency pause (66% supermajority — bypasses timelock)
Staking
Stake $CORTEX tokens to earn a share of protocol fees. Lock your tokens longer for higher multipliers. Rewards are distributed weekly in WETH/USDC.
Fee Distribution
Protocol fees (2% management + 20% performance) are split:
Risk Management
CORTEX tracks comprehensive risk metrics and uses multiple layers of protection.
Sharpe Ratio
Risk-adjusted return
Max Drawdown
Worst peak-to-trough
Value at Risk
95% confidence loss bound
Win Rate
Profitable trade percentage
Safety Mechanisms
- Tier Bounds — Core never drops below 50%, Degen never exceeds 15%
- Slippage Protection — Max 0.5% for stable pairs, 1.5% for Core, 3% for Degen
- Rate Limiting — Max 20 trades per hour, minimum 60% AI confidence
- Multi-Source Oracle — Chainlink + CoinGecko with 2% deviation alert
- Emergency Brake — 66% governance supermajority can pause the AI and trigger full withdrawal
- Transaction Simulation — Every trade is simulated before execution to catch reverts
API Reference
All endpoints are available at https://www.cortexprotocol.net
Authentication
Most endpoints are public. Token-gated endpoints require the x-wallet-address header with a wallet holding 10,000+ $CORTEX tokens.
/api/v1/vault/statsCurrent vault TVL, share price, depositor count, and APY
/api/v1/vault/user/:addressUser position including shares, current value, P&L, and recent transactions
/api/v1/vault/tvl-historyHistorical TVL data points for charting
/api/v1/vault/share-price-historyHistorical share price data points
/api/v1/vault/depositorsCurrent active depositor count
/api/v1/portfolioCurrent portfolio allocation across tiers and individual strategies
/api/v1/portfolio/allocation-historyHistorical tier allocation changes over time
/api/v1/tradesPaginated trade history with tier and type filtering
/api/v1/trades/:idSingle trade details including reasoning and tx hash
/api/v1/performanceHistorical performance data (daily, weekly, monthly)
/api/v1/ai/insightsToken-gatedAI confidence level, market sentiment scores, and current regime
/api/v1/ai/reasoning-feedToken-gatedLatest 10 AI reasoning cycles with decisions and confidence
/api/v1/ai/cyclesTotal and today's AI cycle count
/api/v1/governance/proposalsActive and past governance proposals with vote tallies
/api/v1/governance/statsGovernance statistics (total, active, passed, rejected)
/api/v1/staking/info/:addressStaking position, pending rewards, lock tier, and multiplier
/api/v1/staking/statsTotal staked, effective stake, staker count
/api/v1/risk/metricsPortfolio risk metrics — Sharpe, Sortino, VaR, drawdown, win rate
/api/healthSystem health check
Contributing
CORTEX is open source and we welcome contributions. The codebase is TypeScript throughout with Solidity smart contracts.
Getting Started
$ git clone https://github.com/CortexProtocolBase/Cortex-Protocol.git
$ cd Cortex-Protocol
$ npm install
$ cp .env.example .env.local
$ npm run dev
Running Contract Tests
$ cd contracts
$ forge install
$ forge test
Project Structure
src/ ├── app/ Pages and API routes │ ├── api/v1/ Public REST API │ ├── api/cron/ Automated cron jobs │ └── [page]/ Frontend pages ├── lib/ │ ├── ai/ AI agent (collector, analyzer, executor) │ ├── dex/ DEX adapters (Uniswap, Aerodrome, Aave, Compound) │ ├── oracle/ Price feeds (Chainlink, CoinGecko) │ ├── sentiment/ Social sentiment (Farcaster, Twitter) │ ├── risk/ Risk calculators │ ├── notifications/ Alert dispatchers │ └── indexer/ On-chain event sync ├── hooks/ Wagmi contract hooks └── components/ React UI components contracts/ ├── src/ Solidity contracts ├── test/ Foundry tests └── script/ Deploy scripts