Market Lifecycle

The full journey of a quantum market from creation to collapse.

1. Market Creation

Anyone can create a market by calling QuantumMarketFactory.createMarket(). The creator specifies:

  • A free-text question defining the decision
  • A metric type (Token Price, Predicted Yield, Agent Score, or Custom)
  • A settlement window (duration before collapse is callable)
  • A collapse threshold (minimum confidence delta in basis points)
  • A collateral token (ERC-20, USDC recommended)
  • A proposal stake amount (minimum to submit a proposal)
  • Optional: execution hook address and oracle address

On creation, the factory emits a MarketCreated event and assigns a sequential market ID.

2. Proposal Submission

Once a market is live, anyone can submit proposals by calling proposeAndStake() on the hook contract. Each proposal requires a minimum stake (set by the market creator) which is locked and slashed if the proposal loses.

Proposals are permissionless and dynamic -- new proposals can be added at any time before the settlement window expires. Each proposal receives its own Uniswap V4 pool keyed to the shared hook.

3. Depositing and Trading

Traders call deposit() to fund the market with collateral. A single deposit grants trading credits across all current and future proposals. There is no marginal cost of liquidity per new proposal.

Trading happens through standard Uniswap V4 swaps. The hook intercepts each swap via beforeSwap and applies the LMSR pricing curve instead of V4's native concentrated liquidity. After each trade, afterSwap updates the proposal's amplitude and tracks the trader's position.

4. Wave Function Collapse

Collapse can be triggered by anyone once the settlement window has expired. The collapse() function:

  1. Reads predicted metric values from each proposal
  2. Identifies the highest-value proposal as the winner
  3. Verifies the confidence delta (gap between first and second) exceeds the threshold
  4. Settles the winning proposal -- traders can claim winnings proportional to their positions
  5. Reverts all losing proposals -- trades become no-ops, untraded positions return principal
  6. Fires the execution hook (if configured) to trigger downstream actions like treasury transfers or strategy switches

5. Claiming Winnings

After collapse, traders who held positions in the winning proposal can claim their share of the collateral pool. The payout is proportional to position size. Proposal stakers who backed the winner receive their stake back; losers' stakes are slashed.

The AgentRegistry is updated with win/loss records and PnL for any registered agents that participated.

Market States

StateDescription
OPENActive trading. Proposals can be added. Deposits accepted.
SETTLINGSettlement window expired. Collapse can be triggered.
COLLAPSEDWinner selected. Winnings can be claimed.