What does LVR, Sandwich Bounds and Vault Risk conclude, in numbers, about “Bounding the Sandwich: Your Slippage Tolerance Is the Largest Loss You Offer”?

Answer: Chapter 5 takes only the victim's side: a sandwich can take no more than the slippage tolerance times the quote, and a first-order model gives the tolerance below which no adversary profits, about 0.00427 for a trade of one per cent of a pool one million deep at a 0.30 % fee.

Scope of the numbers: Parameters are illustrative and all calculations are generated by the book's programs. This is general investment risk analysis, not investment advice; it recommends no token, protocol or trade, and crypto-assets are high risk and can be lost in full.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. printed values that match the answer: 0.00427, 0.30

smallest profitable tolerance s_min (exact / first order)
fee 0.05 %
depth y0 a0.002 a=0.01 a=0.05
100,0000.20374/0.20000 0.03131/0.03158 0.00578/0.00606
1,000,0000.02001/0.02000 0.00313/0.00316 0.00058/0.00061
10,000,0000.00200/0.00200 0.00031/0.00032 0.00006/0.00006
fee 0.30 %
depth y0 a0.002 a=0.01 a=0.05
100,000 none / none0.04293/0.04286 0.00611/0.00638
1,000,000 none / none0.00427/0.00429 0.00061/0.00064
10,000,000 none / none0.00043/0.00043 0.00006/0.00006
fee 1.00 %
depth y0 a0.002 a=0.01 a=0.05
100,000 none / none none / none0.00729/0.00750
1,000,000 none / none none / none0.00073/0.00075
10,000,000 none / none none / none0.00007/0.00007

Key formula

\[\pi \approx 2b\,y_0\,(a-g)-G .\]
Show the full program
# Chapter 5. p52: the tolerance below which no sandwich pays.
# Model: as in p51 (constant-product pool, fee g on input, fixed cost G
# for the adversary's two transactions). For each trade size a (share of
# the Y reserve) and pool depth y0 we find by bisection the smallest
# tolerance s_min at which a worst-case adversary's best profit is
# positive. A victim whose tolerance is below s_min faces no profitable
# sandwich in this model. First-order closed form:
#   s_min ~ G / (y0 (a - g)),   and no attack at any s when a <= g.
# G = 30 in units of Y; depths and sizes illustrative.

GAS = 30.0


def buy_x(x, y, d, g):
    out = x * d * (1.0 - g) / (y + d * (1.0 - g))
    return out, x - out, y + d


def sell_x(x, y, e, g):
    out = y * e * (1.0 - g) / (x + e * (1.0 - g))
    return out, x + e, y - out


def best_profit(a_frac, s, g, y0):
    a = a_frac * y0
    quote, _, _ = buy_x(y0, y0, a, g)
    floor = (1.0 - s) * quote

    def run(b):
        got, x1, y1 = buy_x(y0, y0, b, g)
        out_v, x2, y2 = buy_x(x1, y1, a, g)
        back, _, _ = sell_x(x2, y2, got, g)
        return out_v, back - b - GAS

    lo, hi = 0.0, y0
    for _ in range(100):
        mid = (lo + hi) / 2.0
        if run(mid)[0] >= floor:
            lo = mid
        else:
            hi = mid
    return max(run(lo * i / 200.0)[1] for i in range(1, 201))


def s_min(a_frac, g, y0):
    if best_profit(a_frac, 0.5, g, y0) <= 0.0:
        return None
    lo, hi = 0.0, 0.5
    for _ in range(60):
        mid = (lo + hi) / 2.0
        if best_profit(a_frac, mid, g, y0) > 0.0:
            hi = mid
        else:
            lo = mid
    return hi


def fmt(v):
    return "  none " if v is None else "{:.5f}".format(v)


if __name__ == "__main__":
    print("smallest profitable tolerance s_min (exact / first order)")
    for g in (0.0005, 0.003, 0.01):
        print("fee {:.2f} %".format(g * 100))
        print("  depth y0     a=0.002          a=0.01           a=0.05")
        for y0 in (100000.0, 1000000.0, 10000000.0):
            cells = []
            for a in (0.002, 0.01, 0.05):
                ap = None if a <= g else GAS / (y0 * (a - g))
                cells.append("{}/{}".format(fmt(s_min(a, g, y0)), fmt(ap)))
            print("  {:>10,.0f}  {}".format(y0, "  ".join(cells)))

Single source and citation

Fan, Y. (2026). Concentrated-Liquidity Loss-Versus-Rebalancing, On-Chain Sandwich Bounds and Decentralised Vault Risk Control (Version 1.0.0), Chapter 5: Bounding the Sandwich: Your Slippage Tolerance Is the Largest Loss You Offer. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-344 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026344,
  author    = {Fan, Yafu},
  title     = {Concentrated-Liquidity Loss-Versus-Rebalancing, On-Chain Sandwich Bounds and Decentralised Vault Risk Control},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book