Key Formulas Cheat Sheet
Keep this page handy when you need the CLMSR math without re-reading the entire specification. Each block lists the formula, explains when it applies, and points to the contracts that enforce it.
Potential, prices, and loss bound
- Potential: governs the entire surface. The share inventory and liquidity parameter live in WAD precision.
- Bin price: . Because every bin shares the same potential, the prices always sum to 1.
- Maker loss bound: where is the number of bins. Adjusting the tick spacing or liquidity parameter alters the bound predictably.
Trading a range
- Weight update: buying shares multiplies the weights inside each bin of the range by \delta$.
- Cost: , where the sigma terms are the summed weights before and after applying .
- Chunking rule: exponents are evaluated in chunks no larger than
MAX_EXP_INPUT_WAD = 1e18, keeping(chunk/alpha) <= 1.
Outcome and tick mapping
- Tick index: .
- Bin interval:
[L + b s, L + (b+1) s)with the upper edge open to prevent overlap.
Precision and rounding
- Currency to WAD: multiply SUSD amounts by
10^12; divide by the same factor to convert back. - Rounding policy:
- Buys and increases: round up (
fromWadRoundUp). - Sells, decreases, closes, and payouts: round down (
fromWadFloor). - Recommended minimum trade size: SUSD (UI enforced until the Solidity guard ships).
- Buys and increases: round up (
Guard rails
MAX_EXP_INPUT_WAD = 1.0e18MIN_FACTOR = 0.01e18,MAX_FACTOR = 100e18MAX_TICK_COUNT = 1_000_000MAX_CHUNKS_PER_TX = 1_000
Need the longer story? Step back to the Mechanism Overview or jump into the detailed discussions in Cost Function & Rounding and Safety Bounds & Parameters.