Predicta System Architecture π§
Cortex Engine, Hedgehog (Risk), and Mimic (Social) IntegrationOverview: Predicta is an autonomous intelligence layer for decentralized prediction markets. It combines AI-driven alpha generation (Cortex), automated risk management (Hedgehog), and community-driven copying (Mimic).
1. Core Ecosystem Components
| Layer | Component | File / Contract | Role |
|---|---|---|---|
| Intelligence | Cortex Brain | cortex/alpha.py | 7-factor market analysis (E1-E7) |
| Execution | Trader Bot | cortex/cortex_trader.py | Autonomous portfolio manager |
| Risk | Hedgehog (Hedge Engine) | cortex/hedge_adapter.py | Delta-neutral hedging via perps (SynFutures/ZEUS) |
| Social | Mimic Mode | cortex/mimic_relay.py | Multi-user copy trading orchestration |
| Persistence | Personal Vaults | contracts/PreonVault.sol | ERC-4626 personal trading accounts |
| Treasury | Yield Gateway | contracts/YieldGateway.sol | Lending integration (Moonwell) for self-funding bets |
2. Integrated System Map
3. Key Subsystems
3.1 The Cortex Brain (System 2)
The βAnalystβ layer that scores markets from 0 to 1 based on:- E1 - Theta: Time decay.
- E2 - Depth: Order book liquidity.
- E4 - AI Prob: Domain-aware ML prediction (Crypto/Sports/Politics).
- E5 - Delusion: Market price vs. AI conviction.
- E7 - Sentiment: News and social analytics.
3.2 Hedgehog (The Hedge Engine)
Aims for delta-neutrality. When Cortex takes a directional bet on a crypto market (e.g., βBTC > $100kβ), Hedgehog automatically opens an offsetting short position on a perpetual exchange (SynFutures or ZEUS).3.3 Mimic Mode (The Social Relay)
Leverages Farcaster social signals.- Signal: A Leader places a trade.
- Relay: The
mimic_relay.pyservice detects the signal. - Execution: The relay triggers mirror trades for all followers via their individual
PreonVaultcontracts.
3.4 Yield Gateway & Preon Vaults
Predictaβs treasury management system:- Personal Vaults: Each user (or mimic relationship) has a dedicated vault that holds PUSD.
- Yield Generation: Idle funds in vaults can be routed through the
YieldGatewayto Moonwell to earn interest, which can then be used to fund βRisk-Freeβ micro-bets.
3.5 Identity & Simulation (V2)
- Privy: Non-custodial identity provider supporting Email, Social, and Web3 logins.
- Embedded Wallets: Privy-managed MPC EOAs serve as the signers for Smart Accounts.
- Simulation Bypass: A headless authentication mechanism for
persona-simagents using deterministic tokens derived from a shared secret.
4. Technical Stack
- Blockchain: Base (Ethereum L2)
- Identity: Privy (Non-custodial, Social + Email + Wallet)
- Account Abstraction: ERC-4337 (Pimlico / Coinbase CDP Paymaster)
- Smart Contracts: Solidity (Foundry)
- Backend: Python (FastAPI, Web3.py) & Node.js (Next.js Server Actions)
- Frontend: Next.js 15, Tailwind CSS, Lucide React
- Data: Firestore (Real-time sync), Polymarket API (Gamma/CLOB)