How PAMM Works
PAMM runs a Uniswap V2-style constant product formula on virtual reserves — phantom pool balances derived from on-chain state. This page explains the mechanics from first principles.The Three Numbers
At any moment, a PNP market is fully described by three values:| Value | What it is |
|---|---|
| R (Reserve) | Total collateral locked in the contract. Real dollars. |
| S_YES (YES Supply) | Total YES tokens in circulation, held by traders. |
| S_NO (NO Supply) | Total NO tokens in circulation, held by traders. |
Virtual Reserves
The core insight. We define two virtual reserves that we use to run constant product math:V_YES as “how much room is left before YES tokens saturate the reserve.” If nobody has bought YES yet (S_YES = 0), then V_YES = R — the full reserve is available as virtual liquidity for the YES side.
As traders buy YES tokens, S_YES grows and V_YES shrinks. The YES side gets “drained,” making YES more expensive. This is exactly how a Uniswap pool behaves when you drain one side.
Why “virtual”? No one deposited YES or NO tokens into a pool. The pool is a mathematical fiction derived from the reserve and circulating supplies — but it behaves identically to a real constant product AMM.
Spot Prices
The price of the next infinitesimally small unit:Buying Tokens
When a trader pays collateralC to buy YES tokens, the mechanism uses a “complete set decomposition”:
Step 1: Implicit Minting
In any binary market, 1 YES + 1 NO = 1 unit of collateral (a “complete set”). When the trader paysC:
- Conceptually, this mints
CYES andCNO tokens - The trader keeps the
CYES tokens - The
CNO tokens are “sold” back to the virtual pool
Step 2: The Swap
The implicit NO tokens get swapped for additional YES using constant product:Step 3: Total Output
State Changes After a Buy
Rincreases byC(money entered the system)S_YESincreases bytotal_YES_receivedS_NOstays the same (implicit NO tokens absorbed into virtual pool)- Prices adjust: YES becomes more expensive, NO becomes cheaper
Selling Tokens
Selling is the reverse but mathematically trickier. A trader holdsT YES tokens and wants collateral back.
The Problem
To redeem collateral, you need a complete set (equal YES + NO). But the trader only has YES. So:- Sell
xYES tokens to the pool for NO tokens - Pair remaining
(T - x)YES with the NO received - Burn the complete sets for collateral
The Quadratic
Combining the swap formula with the pairing constraint gives:x (how many to swap), and T - x gives the collateral released.
Round-Trip Property
If a trader buys YES and immediately sells back the exact tokens (ignoring fees), they get back approximately what they paid. The curve is path-independent for small trades — it doesn’t “leak” value.Liquidity Depth
The initial reserveR_0 determines how much money it takes to move the price by a given amount.
Small Reserve (R = 100 USDC)
Large Reserve (R = 1,000,000 USDC)
| Market Size | Reserve | Suitable For |
|---|---|---|
| Micro | < 1,000 | Casual bets, highly volatile |
| Small | 1,000 - 10,000 | Niche markets, moderate impact |
| Medium | 10,000 - 100,000 | Popular events, good trading experience |
| Large | 100,000 - 1,000,000 | High-profile markets, institutional depth |
Price Dynamics
What Moves Prices
YES price increases when:- Someone buys YES (increases
S_YES, decreasesV_YES)
- Someone buys NO (increases
S_NO, decreasesV_NO) - Someone sells YES (decreases both
RandS_YES, net effect raisesV_YESrelative toV_NO)
Slippage
The displayed price is the marginal price — what the next tiny unit costs. Larger trades experience slippage because each unit purchased moves the price before the next unit is priced. Slippage increases with:- Larger trade sizes
- Smaller reserves
- Prices near 0 or 1 (one virtual reserve is thin)
Self-Correcting at Extremes
At 50/50 the market is equally liquid on both sides. At 90/10:- Buying more YES is expensive and high-impact (thin
V_YES) - Buying NO is cheap and low-impact (thick
V_NO)
Edge Cases
Price Bounds
Prices can never reach exactly 0 or 1 while the market is active. AsV_YES approaches zero, the price asymptotically approaches 1 but never reaches it. The constant product formula provides natural resistance at extremes.
One-Sided Activity
If only YES is bought and NO supply stays at zero:V_NO is large. The market doesn’t need activity on both sides to function.
Zero Trading Activity
If a market is created, nobody trades, and it expires — the creator callsclaimRemainingReserve() and gets their full deposit back. No loss, no gain.
