# VarianceSwap > Turns the exposure a liquidity provider already has into something they can actually sell. A production Uniswap v4 hook. Source: https://github.com/nirholas/variance-swap. Part of the HookForge catalogue: https://hookforge.pages.dev ## How it works Everybody who has provided liquidity to an automated market maker is short volatility. It is not a choice they made and in most cases not one they were told about: the position loses to whoever rebalances against it, in proportion to how much the price moves, which is the payoff of a short variance position with extra steps. The literature calls it loss-versus-rebalancing, and the practical consequence is that a provider's real risk has no name in the interface and no way to hedge. The exposure exists. What is missing is the other side of it. This hook measures the pool's realised variance from its own ticks, and lets anybody take either end: deposit collateral to be short variance and collect premiums, or pay a premium to be long it and get paid if the pool turns out to be wilder than the strike said. A provider who wants to stop being short volatility can buy exactly enough of the long side to cancel it, in the same contract, denominated in the same units, against the same pool. The variance is the pool's own. It is the sum of squared tick moves the pool actually made, divided by the seconds it took, and it is not quoted by anybody, not signed by anybody, and not available to be reported wrongly. Ticks are log prices, which is exactly what a variance calculation wants, so the pool's own data structure happens to be the correct input with no conversion at all. Every note is fully collateralised when it is written. The most it can ever pay is locked at that moment and released when it settles, so the short side cannot be surprised and the long side cannot be defaulted on. That is a real constraint on how much can be written and it is the right one: an uncollateralised variance seller is a counterparty risk wearing a payoff diagram. ## Prior art Variance swaps are standard over-the-counter equity derivatives. On-chain, Squeeth and this catalogue's own PowerPerp give quadratic price exposure, and Opyn, Volmex and Panoptic build volatility products on option or index machinery, all needing an external mark. Loss-versus-rebalancing is well described in the literature and universally left unhedged. Measuring realised variance from a pool's own ticks and settling fully collateralised notes on it inside that same pool, so the exposure and its hedge live in one contract, is the contribution here. ## Where it does not help Realised variance is sampled per swap, so a pool that trades rarely reports a variance built from few observations and a pool that is quiet between two distant prints understates the path between them. The measure also cannot tell a real move from a manipulated one; on a shallow pool, buying a note and then pushing the price around is a strategy, and the cap on payout is the only thing bounding it. Notes settle in one collateral currency and pay nothing before expiry, so this is a held-to-maturity instrument, not a tradeable one. And the strike is chosen by whoever writes the note rather than discovered, so a badly struck note is simply a bad trade. ## Facts Slug: variance-swap Contract: VarianceSwapHook Callbacks: beforeSwap, afterInitialize 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.