Skip to main content

    Calculation method

    How MoonMath calculates mev exposure

    MEV & Sandwich Exposure Estimator — How much value can adverse execution consume before my swap reverts?

    The formula

    The exposure envelope is the quoted output minus the tolerance floor, and the stressed loss is a chosen share of that envelope valued at the pool's spot price.

    What it reads

    • A quoted output and spot price from the swap engine, computed on an observed pool
    • The slippage tolerance the trader would set
    • The share of the tolerance envelope to illustrate

    What it assumes

    • The envelope share is a dial chosen to illustrate a scenario, not a probability
    • The worst case is bounded by the trader's own tolerance setting, so exposure scales with a setting rather than with market conditions
    • Output is valued at the pre-trade pool spot price

    What this does not establish

    • It does not estimate the likelihood of being sandwiched, and models no attacker, capital or mempool
    • The stressed adverse move is a restatement of the two inputs, not an observed move
    • It says nothing about failed transactions, revert costs, or private-relay protection
    • A small envelope is not evidence that a trade is safe from extraction

    Run it

    Measure how much quoted output and USD value sits inside a swap's slippage tolerance. Compare transparent stress usage of that envelope without claiming that a sandwich attack occurred or will occur.

    Open the MEV Exposure calculator

    How the market itself works

    This page describes MoonMath's arithmetic. The mechanics section describes the market: how an order book forms a price, why order-book depth is not the same thing as pool liquidity, and what a public book does and does not let you observe.

    Read the market mechanics