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

  1. 01Deposit — Users deposit ETH or USDC into the CORTEX vault on Base and receive cVault shares proportional to their deposit.
  2. 02AI Manages — Every 10 minutes, the AI agent analyzes market conditions, sentiment, and risk — then allocates capital across Core, Mid-Risk, and Degen tiers.
  3. 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 Realtime

Frontend

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

BaseScan

0x7A67AFf42d26bDb1A1569C6DE758A4f28e15e4FD

ERC-20 governance token with ERC20Votes and ERC20Permit. Fixed supply of 1,000,000,000 CORTEX.

CortexVault

BaseScan

0x3A0799D13c737b341c41004BF9861eBdba28Dcf1

ERC-4626 tokenized vault. Accepts ETH and USDC deposits, issues cVault shares. AI-managed strategy execution with fee accrual.

CortexStaking

BaseScan

0x494D4ba8BBe8E9041207A206Cd635af343c9007E

Lock-based staking with time multipliers. Stake CORTEX to earn a share of protocol fees paid in WETH.

CortexGovernor

BaseScan

0x11cd3AfcBd99c22B47435DA29E93C26844b8d1Dc

OpenZeppelin Governor with 4% quorum, 3-day voting period, 1-day voting delay, and 24-hour timelock.

Treasury

BaseScan

0xd637A73E056Da2f8761474621B4889c96257d3f3

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

2% annualized

Performance Fee

Charged on net new profits above high-water mark

20% of profits

Withdrawal Fee

Deducted when redeeming cVault shares

0.5%

Deposit Fee

No fee to deposit into the vault

Free

Allocation Tiers

The AI allocates capital across three governance-controlled tiers. $CORTEX holders vote on the allocation bands.

Core

Low Risk
Target: 70%
Range: 50–90%
Assets: WETH, USDC, cbBTC
Protocols: Aave, Compound

Mid-Risk

Medium Risk
Target: 20%
Range: 5–35%
Assets: AERO, DEGEN, LP tokens
Protocols: Aerodrome, Uniswap V3

Degen

High Risk
Target: 10%
Range: 0–15%
Assets: New launches, momentum plays
Protocols: Uniswap V3, Aerodrome

AI 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

01
Collect

Fetches real-time prices from Chainlink and CoinGecko, on-chain TVL and volume data, and social sentiment from Farcaster and Twitter.

02
Analyze

Sends market data to Claude API with system prompt defining tier rules, risk constraints, and allocation targets. Claude returns a structured decision.

03
Validate

Guardrails check: tier allocation bounds, max trades per hour (20), minimum confidence (60%), max position size, and slippage limits.

04
Execute

Approved trades are encoded as calldata and sent through the vault's executeStrategy() function to the target DEX protocol.

05
Log

Full reasoning — market summary, sentiment scores, risk assessment, decision, and executed trades — is stored in Supabase for transparency.

Guardrails

Core allocation: 50–90%
Mid-Risk allocation: 5–35%
Degen allocation: 0–15%
Max 20 trades per hour
Min 60% confidence to trade
Max 1.5% price impact (Core)
Max 3% price impact (Degen)
Emergency pause by governance (66% supermajority)

Governance

CORTEX is governed by $CORTEX token holders. The protocol uses OpenZeppelin Governor with a timelock for all parameter changes.

Parameters

Quorum4% of total supply
Voting Period3 days
Voting Delay1 day
Timelock24 hours
Proposal Threshold100,000 CORTEX

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.

DurationMultiplierEffective APRUnlock
No Lock1.0xBase APRAnytime
1 Month1.5x1.5x Base APRAfter 1 month
3 Months2.0x2.0x Base APRAfter 3 months
6 Months2.5x2.5x Base APRAfter 6 months

Fee Distribution

Protocol fees (2% management + 20% performance) are split:

50% → Stakers
50% → Treasury

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.

GET/api/v1/vault/stats

Current vault TVL, share price, depositor count, and APY

GET/api/v1/vault/user/:address

User position including shares, current value, P&L, and recent transactions

GET/api/v1/vault/tvl-history

Historical TVL data points for charting

GET/api/v1/vault/share-price-history

Historical share price data points

GET/api/v1/vault/depositors

Current active depositor count

GET/api/v1/portfolio

Current portfolio allocation across tiers and individual strategies

GET/api/v1/portfolio/allocation-history

Historical tier allocation changes over time

GET/api/v1/trades

Paginated trade history with tier and type filtering

GET/api/v1/trades/:id

Single trade details including reasoning and tx hash

GET/api/v1/performance

Historical performance data (daily, weekly, monthly)

GET/api/v1/ai/insightsToken-gated

AI confidence level, market sentiment scores, and current regime

GET/api/v1/ai/reasoning-feedToken-gated

Latest 10 AI reasoning cycles with decisions and confidence

GET/api/v1/ai/cycles

Total and today's AI cycle count

GET/api/v1/governance/proposals

Active and past governance proposals with vote tallies

GET/api/v1/governance/stats

Governance statistics (total, active, passed, rejected)

GET/api/v1/staking/info/:address

Staking position, pending rewards, lock tier, and multiplier

GET/api/v1/staking/stats

Total staked, effective stake, staker count

GET/api/v1/risk/metrics

Portfolio risk metrics — Sharpe, Sortino, VaR, drawdown, win rate

GET/api/health

System 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