Market Making & Liquidity Architecture
This document explains how market making and liquidity bootstrapping works on predict.fun.
Overview
Unlike traditional AMMs (Automated Market Makers), we use a CLOB (Central Limit Order Book) model similar to Polymarket. This provides:
- Better price discovery
- Lower slippage for large orders
- Professional market making opportunities
- Liquidity rewards for resting orders
Wallet Architecture
| Role | Address | Purpose |
|---|
| Deployer | 0x636713ebaa76e8703Cd4b9213715bFcdDBc75426 | Deploy contracts, create markets |
| Admin | 0x731255C938387264D038A3F2802C9010Ac002e05 | Pause, configure, resolve markets |
| Operator | 0x7aDB49aE5DF789EE9B9F82614609967cCe4eE23d | Execute gasless trades (CLOB backend) |
| UI Admin | 0xc205035c8a57036bEcD708dc5f778322175eaa9f | Frontend dashboard access |
Initial Market Launch
Step 1: On-Chain Market Creation
// For binary markets
ConditionalTokens.prepareCondition(questionId, 2)
// For multi-outcome markets (NegRisk)
NegRiskOperator.prepareMarket(feeBips, metadata)
NegRiskOperator.prepareQuestion(marketId, outcomeData, requestId) // Per outcome
Step 2: Token ID Generation
Token IDs are generated when the first user splits collateral:
User deposits 10 USDT → Splits into 10 YES + 10 NO tokens
The token IDs are calculated from:
conditionId (from prepareCondition)
indexSet (1 = YES, 2 = NO)
collateralAddress (wUSDT)
Token positions don’t exist until the first split. The backend automatically tracks token IDs after the first user interaction.
Step 3: Break-Even Initial Prices
New markets launch at break-even prices:
| Market Type | Initial Probabilities |
|---|
| Binary (2 outcomes) | 50% / 50% |
| Multi (N outcomes) | 100% / N each |
This ensures no arbitrage at launch and fair price discovery.
Liquidity Bootstrapping Strategies
The platform seeds initial orders around the midpoint:
// Platform bot places initial orders
const SPREADS = [1, 2, 5]; // 1%, 2%, 5% spreads
for (const spread of SPREADS) {
// YES side
placeOrder({ side: 'buy', price: 50 + spread, amount: '$100' });
// NO side
placeOrder({ side: 'buy', price: 50 - spread, amount: '$100' });
}
Strategy 2: Liquidity Rewards Program
Incentivize market makers with rewards for resting limit orders:
interface LiquidityReward {
// Rewards based on:
timeWeighted: number; // Hours order was resting
volumeProvided: number; // Total liquidity provided
spreadQuality: number; // How close to midpoint
balanceScore: number; // YES/NO balance ratio
}
Reward Distribution:
- 50% of trading fees → Liquidity providers
- Bonus multipliers for tight spreads
- Weekly reward payouts in USDT
Strategy 3: Professional Market Makers
For mainnet, partner with professional market makers:
Market Maker Benefits:
- Lower trading fees (0% for MMs)
- API access for high-frequency trading
- Priority order execution
- Revenue share from spreads
What MMs Provide:
- Two-sided liquidity (both YES and NO)
- Tight spreads (1-2% around midpoint)
- Continuous quotes during market hours
- Risk management expertise
Market Maker Risk Management
How MMs Stay Profitable
- Spread Capture: MM buys YES at 48¢, sells at 52¢ = 4¢ profit per round-trip
- Inventory Management: Hedge positions across correlated markets
- Information Edge: React quickly to news and probability shifts
- Fee Rebates: Platform pays MMs for providing liquidity
MM Position Limits
const MM_LIMITS = {
maxPositionPerMarket: 1_000_000, // $1M max per side
maxNetExposure: 100_000, // $100K net long/short
minSpread: 0.02, // 2% minimum spread
maxSpread: 0.10, // 10% maximum spread
};
Fee Structure
| Action | Fee | Recipient |
|---|
| Market Order | 1% | 50% LP, 50% Platform |
| Limit Order (maker) | 0% | N/A |
| Limit Order (taker) | 0.5% | 50% LP, 50% Platform |
| Market Makers | 0% + rebates | Earn from spreads |
Token Split Flow
Multi-Outcome Market (NegRisk)
For markets like “US Election 2028”:
Market: Who wins 2028 Democratic nomination?
Outcomes: 11 candidates
Each outcome = Binary question (Will X win? YES/NO)
NegRisk ensures: Only ONE can resolve TRUE
Initial prices: 9.09% each (100% / 11)
As trading occurs: Prices diverge based on sentiment
Backend Integration
Redis Orderbook Keys
// Order storage
`order:${orderId}` = Hash of order details
// Price levels (sorted sets)
`ob:${marketId}:${tokenId}:buy` = Bids sorted by price DESC
`ob:${marketId}:${tokenId}:sell` = Asks sorted by price ASC
// Trade history
`trades:${marketId}` = List of executed trades
Operator Execution
The Operator wallet (0x7aDB...) executes matched trades:
// Gasless execution flow
1. Maker places signed limit order
2. Taker places matching order
3. Backend matches orders
4. Operator transfers tokens (no user gas needed)
5. Both parties receive their tokens
Display Modes for Markets
| Mode | Description | Best For |
|---|
default | Standard card | Most markets |
featured | Large with chart | Homepage featured |
list | All outcomes visible | Multi-outcome (5+) |
vs | Side-by-side outcomes | Binary “X vs Y” |
minimal | Compact | Dense listings |
Next Steps for Production
- Liquidity Rewards Contract: Deploy on-chain reward distribution
- MM API: WebSocket for real-time order updates
- Hedge Engine: Cross-market position management
- Risk Dashboard: Real-time exposure monitoring