7.3 State Machines

Market Lifecycle

┌─────────────────────────────────────────────────┐
         Phased Dynamic LMSR State Machine       
└─────────────────────────────────────────────────┘

CREATED

   ├─> Initial state after create_market()
   ├─> Status: BOUNDING
   ├─> target_b set (e.g., 1000 USDC)
   ├─> virtual_b = target_b (not dynamic yet)
   ├─> real_pool = $0
   ├─> Outcome tokens minted


BOUNDING Phase

   ├─> Only BUY orders allowed
   ├─> Pool accumulates: real_pool += buy_amount
   ├─> Track trader deposits (for refunds)
   ├─> virtual_b = target_b (fixed)

   ├─> Transition: real_pool >= target_b
   │    └─> Status: ACTIVE, virtual_b = real_pool (becomes dynamic)

   └─> Timeout: end_time && status == BOUNDING
        └─> Status: REFUNDED (full refund to all traders)


ACTIVE Phase (if transitioned)

   ├─> Both BUY and SELL orders allowed
   ├─> CRITICAL: virtual_b = real_pool (always, after each trade)
   ├─> Trading enabled (buy/sell outcome shares)
   ├─> Fees distributed to 4 vaults
   ├─> Volume accumulates

   └─> Timeout: end_time reached
        └─> Status: COMPLETED


COMPLETED Phase

   ├─> Trading disabled
   ├─> Awaiting oracle resolution


RESOLVING (oracles committing/revealing)

   ├─> Commit period: 24-48 hours
   ├─> Reveal period: 24-48 hours


DISPUTED (optional)

   ├─> User submitted dispute + stake
   ├─> Extended voting period
   ├─> Community resolution


RESOLVED

   ├─> Winning outcome determined
   ├─> Winners can claim (proportional to pool)
   ├─> Losers receive nothing
   ├─> Zero-sum settlement (winners from losers)


CLOSED

   └─> All claims processed
       └─> Market archived

REFUNDED (from BOUNDING timeout)

   ├─> All traders refunded their deposits
   ├─> No winners/losers
   └─> Clean closure

Platform Lifecycle

Last updated