# LMSR > A pool whose worst case a provider can read before they deposit. A production Uniswap v4 hook. Source: https://github.com/nirholas/lmsr. Part of the HookForge catalogue: https://hookforge.pages.dev ## How it works A constant-product provider's exposure has no upper bound. As the price moves, the position converges on holding only the losing side, and the loss against simply having held the two tokens grows without limit. Everyone knows this and nobody can quote it, because the answer depends on where the price goes and the curve quotes at every price there is. Robin Hanson's logarithmic market scoring rule was built for exactly this problem, in prediction markets, in 2003: a market maker that will always quote, and whose total loss is bounded by a constant chosen when the market opens. The bound is the whole reason it is used. It has never been the curve of a general-purpose AMM because a bounded-loss maker must also be a bounded-*range* maker, and a pool that stops quoting past a price is a worse product right up until the day it is the only pool that did not get emptied. This pool holds the invariant exp(-reserve0 / b) + exp(-reserve1 / b) = k which prices token0 in token1 at exp((reserve1 - reserve0) / b): exactly one at balance, falling smoothly as the pool fills with token0. The parameter `b` is depth and it is also the bound. Larger `b` is flatter near parity and a wider quoting range; smaller `b` is a tighter market that gives up sooner. There is one number to choose and it means one thing. What a provider gets that no constant-product pool offers is a figure: {maxLoss} is what this curve can cost them in the worst case anybody can construct, published on-chain, before they deposit. Beyond the range the curve refuses the trade instead of quoting a price it cannot honour, which is the same promise stated from the other end. ## Prior art The scoring rule is Hanson's, and Gnosis, Augur and Polymarket's predecessors all ran variants of it for prediction markets, where outcomes sum to one and shares are minted rather than held. Constant-product, StableSwap and the v4 custom curves built on them are all unbounded-range makers. Bringing a bounded-loss scoring rule to a two-sided token pool, with the bound published as a view a provider reads before depositing, is the contribution here. ## Where it does not help The range is finite by construction, so a pool whose true price leaves the band stops quoting on that side and holds the losing asset until the price returns; that is the bounded loss being collected, not a malfunction. It is the right curve for pairs expected to stay near a ratio and the wrong one for anything that can genuinely revalue. The maths runs through fixed-point exponentials, so a swap costs meaningfully more gas than constant product. And `b` is fixed at deployment: a pool that wants a different depth is a different pool. ## Facts Slug: lmsr Contract: LMSRHook Callbacks: beforeSwapReturnsDelta, beforeSwap, beforeRemoveLiquidity, beforeAddLiquidity, beforeInitialize Parameters: none Dynamic fee required: no ## Caveats - Unaudited. - A deployment with status "deterministic" is a mined CREATE2 address with no code at it yet. Never present one as live.