Bounded no-theft: bound explorer
This interactive calculator evaluates the machine-checked HOL4 bound for a two-coin plain Curve StableSwap-NG pool (proved against the Vyper source) at parameter limits you choose. It computes the proven upper bound rather than simulating individual attacks; the actual profit of any run is at most the bound. self-check…
The theorem
bounded_no_theft_readable holds for any finite sequence of pool calls and outside
token transfers, where callers denotes the set of all addresses that call the pool during
the run (called attackers in the formal statement). When passive liquidity providers retain at
least their initial LP tranche throughout the run (passive_lps, so the pulled-LP
allowance π is zero; see bounded_no_theft_readable_passive), it establishes:
Here V₀ ≤ Q is the starting value of the pool's reserves and I = Q − D*
(initial_imbalance) is the pool's starting rebalancing arbitrage—the pre-fee value
the curve offers at the peg for trading an off-balance pool back to 50/50. The headline figure
below isolates E − I = 2P + n · (⌊√(Q + W₀ + X + 5)⌋ + 13), the maximum callers can extract
beyond rebalancing arbitrage (and when all borrowed funds are repaid with fees F, net gain is at
most E − F by bounded_no_theft). All quantities are measured in value units at the
pool's fixed initial rates (1018 per whole coin under standard factory rates) and
converted to USD at the peg price below. For the full walkthrough, the general bound including π,
and the scope limits, see the overview
(docs/bounded_no_theft.md); for each formal hypothesis, see
the assumptions in the theorem explorer.
Limits
The bound
This rounding term depends only on Q, W₀, X, n, and coin decimals; the reserve split and amplification A enter solely through the rebalancing arbitrage I below.
Passive LPs' loss (beyond normal rebalancing arbitrage) ≤
Rebalancing arbitrage available at the start: I = , paid to whoever trades the pool back to 50/50 at the peg (computed from the reserve share and A above).
As the theorem states it
E = I + 2P + n · (⌊√(Q + W₀ + X + 5)⌋ + 13) = proved
Passive LPs' loss ≤ I + P + n · (⌊√(Q + W₀ + X + 5)⌋ + 13) = proved
bounded_no_theft_readable: the callers' net gain beyond what they borrow is
at most min(V₀, E), and the second conjunct bounds the collective reserve-share loss of the LP
tokens not held by callers at the start (when passive holders retain their LP tokens throughout
the run). Both bounds include I.
Here E reaches or exceeds the pool-size limit Q, so the cap
min(V₀, E) in bounded_no_theft_readable is governed by V₀ ≤ Q: callers can never
extract more than the pool's initial reserves.
Displayed figures round up in the last digit; hover for coin amounts and exact value units.