System Architecture
High-Level Overview
The BaseCase protocol implements a multi-phase prediction market system with the following component structure:
Component Responsibilities
Frontend Layer
UI Framework
React 18
User interface rendering
State Management
React Context
Application state
Web3 Integration
Wagmi + Viem
Blockchain interaction
Build Tool
Vite
Development and production builds
Contract Layer
MarketFactory
Market creation and registry
ShadowMarket
Virtual CPMM, shadow accounting
GraduationManager
Token minting, distribution
OutcomeToken
ERC-20 YES/NO token contracts
OracleResolver
UMA Oracle integration
External Integrations
ERC-20
Standard token interface
UMA Oracle
Decentralized dispute resolution
Order Book
Post-graduation trading venue
Data Flow
Phase 1: Bonding Curve
Phase 2: Graduation
Phase 3: Resolution (Winner Profit Guarantee)
State Machine
Markets progress through a defined lifecycle:
CREATED
Market initialized
→ BONDING
BONDING
Virtual CPMM active
→ GRADUATED, FAILED
GRADUATED
Real tokens, Order Book trading
→ RESOLVED
FAILED
Solvency not reached
Terminal
RESOLVED
Outcome determined
Terminal
DISPUTED
Oracle dispute active
→ RESOLVED
Technology Stack
Blockchain
Base (Ethereum L2)
Smart Contracts
Solidity 0.8.20
Development Framework
Foundry
Frontend
React + Vite
Web3 Library
Wagmi + Viem
Indexing
The Graph (planned)
Oracle
UMA Optimistic Oracle V3
Security Architecture
Trust Assumptions
Smart Contracts
Code correctness (auditable)
UMA Oracle
Honest majority of voters
Order Book
Contract security
Base L2
Sequencer liveness
Attack Vectors and Mitigations
Price manipulation
CPMM slippage, fee accumulation
Flash loan attacks
No flash loan integration points
Oracle manipulation
UMA dispute mechanism, bond requirements
Front-running
Slippage tolerance parameters
Last updated

