# BlazePhoenix-Dex Whitepaper v2.4.0 — part 9 of 9: Appendices (A, B, C, D, E) > One part of the whitepaper in llms.txt form; every part and every section is listed in > https://blazephoenix.xyz/whitepaper/llms.txt. The parts are the full text, unabridged: the bodies of parts > 1-9, joined in order, are https://blazephoenix.xyz/whitepaper.md byte for byte (sha256 a47389f947e4aa6656f693004e43fbe3e0101dccaf133e49c303767811f223cc). > Cite as https://doi.org/10.5281/zenodo.24517342; numbering (§, E, INV-) as in the paper. ----- verbatim text of whitepaper.md follows ----- ## Appendix A · The primitive equations Every quantitative claim in this paper reduces to one of the following. Each is implemented once, in the contract named, and imported everywhere else. The numbering E1–E22 is stable from the 2.2 edition, E23–E26 were added in 2.3, E43–E52 in 2.4 (their DEX line numbers at `6387350`), and E27–E42 are the staking engine's (§25): "Staking" in the fourth column names `src/BlazePhoenixStaking.sol` of the staking repository at `9958d5f`, with its line numbers at that commit. E27–E30 are restated for the 2.4 schedule of 90,000,000 BZPX over eight years per deployment. | # | Name | Equation | Defined in | § | |---|---|---|---|---| | E1 | Meta-Equation | $R^{\star} = \arg\max_{R}\ \mathrm{net}(R)\cdot\prod_{\ell}\hat{\Psi}(p_{\ell})\cdot\mathbf{1}[\mathrm{net}(R)\ge\Phi(R)]\cdot\Xi(R)$ | Solver pipeline | §3 | | E2 | Constant-product output | $y = \lfloor x(\mathrm{BPS}-f)\,r_{\mathrm{out}} / (r_{\mathrm{in}}\,\mathrm{BPS} + x(\mathrm{BPS}-f)) \rfloor$ | Core `outV2` | §4.2 | | E3 | Concentrated-liquidity output (within tick) | $\sqrt{P}' = L\sqrt{P}/(L + x_{f}\sqrt{P}/Q_{96})$, $y = L(\sqrt{P}-\sqrt{P}')/Q_{96}$; dual form for the other direction | Core `outV3` | §4.2 | | E4 | V4 storage base slot | $\mathrm{slot} = \mathrm{keccak256}(\mathrm{abi.encode}(\mathrm{poolId}, 6))$; $\sqrt{P}$ in bits [0,160), LP fee in [208,232) of word 0; $L$ in word 3 | Core `v4SqrtAndLiq` | §5 | | E5 | Solidly stable invariant | $k(x,y) = x^{3}y + xy^{3}$ | Core `_solK` | §6 | | E6 | Solidly Newton step | seed $y_{0} = Y$; up-step $\max(1, \lfloor (K-k)/f' \rfloor)$; down-step $\max(1, \lfloor (k-K)/f' \rfloor)$, replaced by $\lfloor y/2 \rfloor$ when it would reach or cross zero; exit at $\lvert y_{n+1}-y_{n}\rvert \le 1$, then up to two one-wei climbs while $k < K$ (a third returns the seed) and up to two one-wei descents while the wei below still holds $K$; cap 64 → seed → quote 0 | Core `_solY` | §6 | | E7 | Decimal normalisation | $X = r_{\mathrm{in}}10^{18-d_{\mathrm{in}}}$, $Y = r_{\mathrm{out}}10^{18-d_{\mathrm{out}}}$, de-scaled after the solve | Core `_solidlyStable` | §6 | | E8 | CREATE2 derivation | $\mathrm{pool} = \mathrm{addr}_{20}(\mathrm{keccak256}(\mathtt{0xff} \Vert \mathrm{origin} \Vert \mathrm{salt} \Vert \mathrm{initCodeHash}))$ | Core `create2Address`, `deriveAddress` | §7 | | E9 | Monoslot packing | $s = a \,\vert\, f\!\ll\!8 \,\vert\, k\!\ll\!32 \,\vert\, r\!\ll\!40 \,\vert\, (c\wedge\mathtt{0xFFF})\!\ll\!48 \,\vert\, b\!\ll\!60 \,\vert\, \dots \,\vert\, \tau\!\ll\!224$, with $\tau$ the pool's own clock (EMA in seconds between anchored ticks, 0 = not yet measured) | Core `encodeSlot` | §8 | | E10 | Vitality Field | $\Psi = V \cdot 2^{b} \cdot (1 + 0.25\,\mathbf{1}_{\mathrm{bridge}}) \cdot (1 + 0.05\,\mathbf{1}_{\mathrm{conc}})$ | Core `psi` | §9.2 | | E11 | Activity decay | $V = \max(1, \lfloor c \cdot 24{,}576/h \rfloor)$, $c = (\mathrm{swapCount} \gg \sigma) - \lfloor c\,(a \bmod h)/(2h) \rfloor$, $\sigma = \lfloor a/h \rfloor$, $a = t - t_{\mathrm{last}}$, $h = 4\tau$ (24,576 s while $\tau = 0$); 0 once $\sigma$ exceeds 31 | Core `vitality`, `_decay` | §9.2 | | E12 | Depth bucket | $b = \min(15, \lfloor \log_{10}(d/10^{15}) \rfloor)$ | Core `depthBucket` | §9.2 | | E13 | Eviction hurdle | $2^{b(d_{\mathrm{new}})}(1 + 0.25\,\mathbf{1}_{\mathrm{bridge}}) > \Psi_{\mathrm{worst}} + \lfloor \Psi_{\mathrm{worst}}/4 \rfloor$ | Hub `_canInsert` | §9.3 | | E14 | Split gate | keep the split iff $\mathrm{out}_{\mathrm{split}} \ge \mathrm{out}_{\mathrm{single}}\cdot(1 + 25/10^{6})$, $\mathrm{out}_{\mathrm{single}}$ the best single leg at full size among every survivor of the believability band | Solver `_buildHop` | §10.4 | | E15 | Iron-Law floor | $\mathtt{floorBps} = \max(9{,}600 - \mathtt{legShv} - \min(\delta, 10^{4}) - \sigma_{\ln}/10^{14},\ 8{,}000)$ | Core `ironFloorBpsShv` | §11.5 | | E16 | Effective minimum | $\mathtt{effMin} = \max(\mathtt{userMinOut},\ \mathtt{route.singleOutFloor},\ \lceil \mathtt{finalHopQuote}\cdot\mathtt{floorBps}/10^{4}\rceil)$; the second term dropped and the third re-scaled by the measured net ratio when fee-on-transfer is detected | Router `_execute` | §11.5 | | E17 | Protocol fee | $\mathrm{fee} = \lceil 28 \cdot \mathrm{base} / 10^{4} \rceil$, base = the fee hop's measured input (anchored), the gross output (direct route into a bridge coin), or each hop's measured input (exhaustion); $t_{1} = \lfloor 3{,}000\cdot\mathrm{fee}/10^{4} \rfloor$, $t_{2} = \mathrm{fee} - t_{1}$ | Router `_chargeHopFee`, `_payFee` | §13 | | E18 | Hook gate | $(\mathrm{uint160}(\mathrm{hook}) \,\&\, \mathtt{0x3FFF}) \,\&\, ((1\ll 3)\mid(1\ll 2)) \ne 0 \Rightarrow$ leg refused, no call made | Core `hookAltersDeltas`; Router | §14.2 | | E19 | Dynamic-fee gate | $f_{\mathrm{eff}} = p + f_{\mathrm{key}} - \lfloor p\,f_{\mathrm{key}}/10^{6} \rfloor$ if static, $p$ the manager's protocol fee in the swap's direction; unquotable if the sentinel rides with a non-zero protocol fee; else the live LP fee from `slot0` / `globalState` / the pool's `fee()` | Core `effV4Fee`, `quoteV3Fee` | §5.4 | | E20 | V2 fee ceiling | $f_{\mathrm{eff}} = f_{\mathrm{decl}}$ if $0 < f_{\mathrm{decl}} \le 100$ bps, else 30 | Core `effV2Fee`; the same rule for the Solidly declared fallback | §4.2 | | E21 | Preview safety buffer | $s = \min(\max(0, n-2) + 5a,\ 10)$ bps | Quoter `_pack` | §12.1 | | E22 | Surface choice | carry the route in calldata iff $p_{\mathrm{byte}} < \rho^{*}$; $\rho^{*}$ measured 66.9–105.5 gas/byte by route shape | `test/EquationBench.t.sol` | §17.6 | | E23 | Leg shave from concentration | $\mathtt{legShv} = \sum_{\mathrm{hops}} \lfloor 200\,((\sum a)^{2} - \sum a^{2})/\sum a^{2} \rfloor$ | Core `legShaveBps` | §11.5 | | E24 | Aggregate hop floor | $\sum \mathrm{got} + \lfloor (\mathrm{BPS} - 8{,}000)\cdot \lfloor \sum \mathrm{attested}/n \rfloor / \mathrm{BPS} \rfloor \ge \sum \mathrm{attested}$ | Router `_execute` | §11.3 | | E25 | Believability centre | the depth-weighted median: sort $(r_{i}, d_{i})$ by $r_{i}$, return the first $r_{i}$ at which $\sum_{j \le i} d_{j} \ge \lceil \sum d / 2 \rceil$; band around the centre whose width each venue earns from its fee and its measured error (`_inBand`) | Solver `_depthWeightedMedian` | §10.3 | | E26 | Fee regime predicate | $\mathrm{feeHop} = \min\{h : \mathrm{isBridge}(\mathrm{hops}[h].\mathrm{tokenIn})\}$; charge at $h$ iff $\neg\mathrm{feeOnOut} \wedge (\mathrm{feeHop} = \infty \vee h = \mathrm{feeHop})$; $\mathrm{feeOnOut} \iff$ one hop and $\mathrm{isBridge}(\mathrm{tokenOut})$ | Core `feeCalendar`, `paysOnInput`; Router `_execute` | §13.1 | | E27 | Emission closed form | $E(t) = 0$ for $t \le s$; $R_{b}\tau + (S - (S \gg p)) + (R_{0} \gg p)(\tau - pP)$ for $s < t < s + 4P$; $B + S - (S \gg 4)$ from $s + 4P$; $\tau = t - s$, $p = \lfloor \tau/P \rfloor$, $R_{b} = \lfloor B/L \rfloor$, $R_{0} = \lfloor (S/2)/P \rfloor$ | Staking `_emittedAt` (L1665–1675) | §25.3 | | E28 | Emission window | $r = \min(\lfloor (E(t') - E(t_{\ell}))\min(W, W_{\min})/W_{\min} \rfloor,\ \mathit{RR})$; $A \mathrel{+}= \lfloor r \cdot 10^{18}/W \rfloor$ | Staking `_windowReward`, `_updateGlobal` (L1620–1650) | §25.3 | | E29 | Settlement | $\mathrm{due}_{u} = (\lfloor w_{u}A/10^{18} \rfloor - c_{u})^{+} - \mathrm{excess}_{u}$, then $c_{u} \leftarrow \lfloor w_{u}A/10^{18} \rfloor$ | Staking `_settleEmission`, `_settlePendingRewards` (L1699, L2141–2152) | §25.3 | | E30 | Lock boost and weights | $b(\ell) = 10^{4} + \lfloor 750\ell/365 \rfloor + \lfloor 250\ell^{2}/365^{2} \rfloor$ bps, $\ell$ the lock in force, capped at 2,555 days; $w_{u} = \lfloor (s_{u} - d_{u})^{+} b/10^{4} \rfloor$; $w^{\mathrm{p}}_{u} = \lfloor s_{u} b/10^{4} \rfloor$ iff $d_{u} = 0$ | Staking `boostByDays`, `_computeBoost` (L544–553, L1980–1985) | §25.3 | | E31 | Interest curve | $r = 100 + \lfloor 500U/10^{18} \rfloor$ for $U \le 0.8 \cdot 10^{18}$, else $500 + \lfloor 72{,}500(U - 0.8 \cdot 10^{18})/10^{18} \rfloor$ bps a year, with $U$ capped at $10^{18}$ (ceiling 15,000 bps) | Staking `_interestRate` (L2074–2080) → `simulateRate` (L2623–2627) | §25.4 | | E32 | Interest index and slice | $\delta = \lfloor \lfloor 10^{18} r/10^{4} \rfloor \Delta t / Y \rfloor$, $\sigma = \lfloor D\delta/10^{18} \rfloor$; if $\sigma > S$, $\delta = \lfloor S \cdot 10^{18}/D \rfloor$ and $\sigma$ recomputed | Staking `_interestSlice`, `_updateInterestIndex` (L1818–1890) | §25.4 | | E33 | Slice split | $\kappa_{r} = \lfloor 300\sigma/10^{4} \rfloor$ to the reserve; $\eta = \lfloor (\sigma - \kappa_{r})\min(W_{\mathrm{p}}, W_{\min})/W_{\min} \rfloor$ to pure stakers; the rest to the reserve | Staking `_updateInterestIndex`, `_dampPure` (L1818–1855, L1901–1903) | §25.4 | | E34 | Interest attribution | $i_{u} = \lfloor d_{u}(I - I_{u})/10^{18} \rfloor$, charged to $s_{u}$; any excess over $s_{u}$ is a loss to E37 | Staking `_accrueInterestFor` (L1905–1954) | §25.4 | | E35 | Conservation guard | $\lvert \Delta(B + D + \mathit{BD}) - \Delta(S + \mathit{RR} + \mathit{PR} + \Pi) \rvert \le 10^{10}$ | Staking `conserves` (L467–505) | §25.5 | | E36 | Owed and solvency | $\mathrm{owed} = (S + \mathit{RR} + \mathit{PR} - D)^{+} + \Pi$; hard breach iff $B + 10^{10} < \mathrm{owed}$ | Staking `_owed`, `_hardBreach`, `isSolvent` (L2096, L2184, L2206) | §25.5 | | E37 | Loss waterfall | $\kappa = \min(\lambda, \mathit{PR})$; $\mathit{PR} \mathrel{-}= \kappa$; $\mathit{BD} \mathrel{+}= \lambda - \kappa$ | Staking L1252–1257, L844–849, L1938–1946, `syncEquity` (L748–751) | §25.5 | | E38 | Recapitalisation | $\rho = \min(\mathit{BD}, \mathit{PR})$, $\gamma = \min(a, \mathit{BD} - \rho)$; $\mathit{BD} \mathrel{-}= \rho + \gamma$ | Staking `absorbBadDebt` (L711–720) | §25.5 | | E39 | Liquidation | liquidatable iff $d_{u} > 0 \wedge (s_{u} = 0 \vee 100 d_{u} \ge 95 s_{u})$; $\mathrm{seized} = \min(d_{u} + \lfloor 500 d_{u}/10^{4} \rfloor, s_{u})$; loss $(d_{u} - s_{u})^{+}$ | Staking `_executeLiquidation`, `_isLiquidatable` (L1225–1288) | §25.5 | | E40 | Emergency haircut | $x_{0} = (s_{u} - d_{u})^{+}$, $E' = E_{+} - e_{u} + x_{0}$; $x = \lfloor x_{0}\,\mathrm{pot}/E' \rfloor$ if $\mathrm{pot} < E'$, else $x_{0}$; $x \le \mathrm{pot}$ | Staking `emergencyWithdraw` (L821–835) | §25.5 | | E41 | Borrowing ceilings | $d_{u} + a \le \lfloor 50(s_{u} - d_{u})^{+}/100 \rfloor$ and $\lfloor (D + a) 10^{18}/S \rfloor \le 0.75 \cdot 10^{18}$ | Staking `borrow`, `_ltvCap` (L974–980, L2305–2306) | §25.5 | | E42 | Maintenance budget | $c(n) = \min(1 + \lfloor n/50 \rfloor + \lfloor (t - t_{m})/900\ \mathrm{s} \rfloor,\ 10,\ n)$ per registry | Staking `_windowBudget` (L1299–1308) | §25.5 | | E43 | Walk gas window | $W = \min(\lfloor 63\,(S - s - 20{,}000)/64 \rfloor,\ \mathrm{WALK\_CAP})$, $S = \mathrm{SOLVE\_GAS} - 1{,}200$, $s$ the gas the search spent; the solve stops if it entered on less than $S$ or if $s + 20{,}000 \ge S$ | Solver `_walkOnItsOwnBudget` (L324, L339–341) | §12.4 | | E44 | Pool depth | $d = \min(\hat{x}_{0}, \hat{x}_{1})$, each side normalised to 18 decimals; $x_{i}$ the reserves for reserve families; $x_{0} = \lfloor L Q_{96}/\sqrt{P} \rfloor$, $x_{1} = \lfloor L\sqrt{P}/Q_{96} \rfloor$ for concentrated ones, $d = 0$ if $\sqrt{P} = 0$; the $d$ of E12 | Core `shortSide18`, `depthFromL18` (L1165, L1185) | §4.2 | | E45 | Leg impact | reserve family: $\iota = \min(\lceil 10^{4} x/(r_{\mathrm{in}} + x) \rceil,\ 10^{4})$, $10^{4}$ if $r_{\mathrm{in}} = 0$; concentrated: $\iota = (10^{4} - \rho)^{+}$, $\rho$ the realised output over the spot-price output in bps ($10^{4}$ if either is zero); 50 bps for every other leg and for a concentrated leg that quotes zero | Core `impactV2Bps`, `impactV3FromOut`, `legQuoteImpact` (L3412, L3469, L3084) | §11.5 | | E46 | Route impact | $\delta = \lfloor \sum_{h}\sum_{\ell \in h} \lfloor \min(\iota_{\ell}, 10^{4})\, n_{h}\, a_{\ell}/A_{h} \rfloor / N \rfloor$, $n_{h}$ the legs of hop $h$, $A_{h} = \sum_{\ell \in h} a_{\ell}$, $N$ the route's declared legs; the $\delta$ of E15 | Core `wImp`, `routeFloorBps` (L3381, L3392); Router `_execute` | §11.5 | | E47 | Per-leg floor | $\mathrm{got}_{\ell} \ge \lceil 8{,}000\,\mathrm{bound}_{\ell}/10^{4} \rceil$, else the swap reverts (`RouterE(5)`); $\mathrm{bound}_{\ell} = \max(\lfloor e_{\ell}\,x/a_{\ell} \rfloor,\ \lfloor \lfloor q_{\ell}\,x/a^{q}_{\ell} \rfloor \cdot 5{,}000/10^{4} \rfloor)$, $x$ the amount the leg actually spent, $e_{\ell}, a_{\ell}$ the caller's attested output and input, $q_{\ell}, a^{q}_{\ell}$ the quote measured in-frame and its input, each term 0 when either of its pair is 0; on a reserve-family leg whose pool received $\mathrm{took} < x$, $\mathrm{bound} \leftarrow \lceil \mathrm{bound}\cdot\mathrm{took}/x \rceil$; no check while $\mathrm{bound} = 0$ | Router `_execScaled` (L1788–1791, L1839–1843, L1886, L1894) | §11.3 | | E48 | Output net of input fees | for each hop $h$ in order that pays on its input (E26): $\mathrm{net} \leftarrow \lfloor \mathrm{net}\,(b_{h} - f_{h})/b_{h} \rfloor$ if $b_{h} > f_{h}$, else 0; $f_{h} = \lceil 28\,b_{h}/10^{4} \rceil$, $b_{h}$ the hop's planned input, $\mathrm{net}$ starting from the route's gross output; the frame in which the Solver attests `singleOutFloor` and the Quoter rescales it | Core `netOfInputFees`, `paysOnInput` (L461, L451); Solver L1911; Quoter L876 | §11.5 | | E49 | Band membership | $p_{i} = \lfloor r_{i}10^{6}/(10^{6} - f_{i}) \rfloor$ ($r_{i}$ if $f_{i}$ is unknown); $\kappa(f, e) = (1 - f)(1 - \min(e, 1))$ in WAD, rounded down; row $i$ is kept iff $p_{i}\,\kappa_{i}\,\kappa_{*}\,(1 - f_{*}) \le p_{*}$ and ($f_{i}$ unknown or $p_{i} \ge p_{*}\,\kappa_{i}\,\kappa^{o}_{*}$), with $\kappa_{i} = \kappa(f_{i}, e_{i})$ ($f_{i} = 0$ if unknown), $\kappa_{*} = \kappa(f_{*}, e_{*})$, $\kappa^{o}_{*} = \kappa(f_{*}, e^{o}_{*})$, $e^{o}_{*}$ the base's error bound at the hop's size; every product rounded down; a base whose fee is unknown keeps every live row | Math `_inBand`, `_keep`, `_prices` (L511, L543, L552) | §10.3 | | E50 | Probe size | $\pi = \lfloor m/100 \rfloor$, or $m$ when that is 0, $m$ the hop's input; each candidate is quoted once at $\pi$ for the band and the weights of E25 | Solver `_buildHop` (L673–674) | §10.2 | | E51 | Median weight | the tokenOut side the venue holds at its own price, in 18 decimals: the out reserve for reserve families; $\lfloor L\sqrt{P}/Q_{96} \rfloor$ or $\lfloor L Q_{96}/\sqrt{P} \rfloor$, the side paid out, for concentrated books and V4; for a Gate wrapper its $\mathrm{depthWad}$, times $\hat{o}/\hat{\imath}$ (this quote's output over its input, 18 decimals) when $\hat{o} > \hat{\imath}$; the Solver caps a quoting reserve or concentrated row at its measured tokenOut balance and reads 0 as 1; the $d_{i}$ of E25 | Core `_quoteArms` (L1932–1936, L1961, L1997, L2014), `_v4Quote` (L2185), `outSide18` (L1201); Solver `_buildHop` (L745, L784) | §10.3 | | E52 | Pool clock | on an anchored tick with $t_{\mathrm{last}} \ne 0$ and $\Delta t = t - t_{\mathrm{last}} > 0$: $\tau \leftarrow \tau + \lceil (\Delta t - \tau)/8 \rceil$ if $\Delta t \ge \tau$, else $\tau - \lceil (\tau - \Delta t)/8 \rceil$, from $\tau = 24{,}576/4 = 6{,}144$ s while $\tau = 0$; any other tick leaves $\tau$ as it was; the $\tau$ of E9 and E11 | Core `tickSlot` (L3286–3305), `TAU_EMA_SHIFT` (L2925) | §9.2 | ## Appendix B · The invariants These are the properties that hold in every reachable state: each is enforced by the shape of the code at the site named, and a transaction that would violate one does not execute. INV-1–INV-18 keep their numbers from the previous editions, INV-18 and INV-22 brought to the code of this edition; INV-19–INV-22 were added in 2.3; INV-23–INV-31 are the staking engine's (§25), enforced in `src/BlazePhoenixStaking.sol` of the staking repository at `9958d5f`, with line numbers re-derived for that commit. B.1 is the numbered list; B.2 is the catalogue of the stateful `invariant_*` campaigns of both repositories, with the mutant that is on record as killing each. ### B.1 The numbered invariants | # | Invariant | Enforcement | |---|---|---| | INV-1 | The Router holds no user funds between transactions: the only balance it keeps at rest is a fee share a token refused to deliver, booked to its treasury slot (`owed`) and pulled by `claimFee`. | Baseline-scoped sweeps and payout (§11); `invariant_RouterHoldsNothing`, `HoldsNothingBeyondTheSeed` | | INV-2 | Every swap is atomic: no state exists in which part of a trade settled. | EVM transaction semantics; one frame | | INV-3 | No oracle: no external price feed is an input to admission, ordering, splitting, flooring or fees. | No feed call exists in the contracts | | INV-4 | The fee rate, the fee split and the floor constants have no setters in the deployed bytecode. | Compile-time constants in the Core and the Router (§13) | | INV-5 | Caller-supplied route fields can tighten protection, never loosen it. | E16 three-way maximum; the coverage gate lifts an attestation, never lowers it (§11) | | INV-6 | A swap with a zero minimum does not execute. | `RouterE(10)` at every door | | INV-7 | Ψ ranks and truncates candidates; no quote, floor or allocation reads it. | Data flow: nothing downstream of ranking consumes Ψ (§9.6) | | INV-8 | A pair's registry holds at most sixteen pools, and eviction keeps the fittest by full Ψ with the margin of E13. | Hub `_canInsert`; `invariant_neverExceedsMaxSlots` (the cap); `test_RecordSwap_EvictsWeakestWhenFullAndNewcomerClearsMargin` (the eviction) | | INV-9 | No address without runtime bytecode enters a route. | `hasCode` on every derivation (§7) | | INV-10 | The universal callback pays only the pool committed for the current leg, only while a leg is in flight, and never more than the leg's recorded budget. | Transient leg context; `RouterE(6)` for the pool, `RouterE(8)` for the budget (§11.4) | | INV-11 | A V4 hook whose address declares delta-altering permissions is rejected before any token moves, without calling it. | E18; `RouterE(9)`; Solver `_rankedPools` | | INV-12 | No pricing product can overflow: every dangerous multiplication is factored through 512-bit `mulDiv`, and a state that cannot be bounded quotes zero. | Core (§4.2, §6) | | INV-13 | Rounding runs against over-promise: quotes and payouts floor, protective floors and the fee round up. | Core `mulDiv` / `mulDivUp` at each site | | INV-14 | Where a bound cannot be proven, the computation returns zero and the venue is surrendered — never a guess, never a schedulable revert inside a quote. | Fail-closed posture across the Core; `_solKFits` (§6) | | INV-15 | The fee base is the measured pull, capped by the route's committed input — never a declared output; `route.totalOut` is read by nothing. | `_chargeHopFee`; `test_FeeBase_IgnoresLiedAboutTotalOut` | | INV-16 | Renunciation is one-way: the flag is written `true` at one site and `false` at none; after it, only the grow-only curator tier remains, and a moved factory or hook cannot be re-armed. | `renounceControl` on Hub and Router (§14.7) | | INV-17 | A declared constant-product or Solidly fallback fee is believed only within a 100 bps ceiling; outside it the canonical 30 bps prices the pool. | E20 | | INV-18 | No hop carries more than five legs and no route more than two hops, so no route carries more than ten legs; the bound is the product `MAX_HOPS` × `MAX_LEGS_PER_HOP` and nothing else, with one producer for the Router, the Quoter and the Solver. | Core `MAX_HOPS` = 2 (`BlazePhoenixCore.sol:136`), `MAX_LEGS_PER_HOP` = 5 (:149); Router `_execute` → `RouterE(3)`; Quoter `_hookRefusedIn`; the Solver builds every stage on the same constant | | INV-19 | A pool enters the registry only if it proves it trades the pair: `token0()`/`token1()` for pair-shaped kinds, re-derivation of the pool id for V4; an asked pool proves the same before discovery lists it. | Hub `recordSwap`, `_probe`; `invariant_ActiveEntriesTradeThePair` | | INV-20 | A settlement pays the protocol fee exactly once on an anchored route and once per hop on an exhausted one; a settlement that paid nothing does not exist. | Fee ledger, `RouterE(15)`/`RouterE(16)`; `invariant_SettledSwapEmitsExactlyOneFee` (anchored); `test/FeeSeals.t.sol`, `test/ExhaustionRegimePreviewParity.t.sol` (exhaustion) | | INV-21 | Hops chain — each hop's input is the previous hop's output — and no hookless leg executes after a hooked one, in this or any later hop (`sawHooked` is route-wide). | Router `_execute` → `RouterE(3)`; `sawHooked` | | INV-22 | The Hub, Solver, Router and Quoter ship under the project's 24,000-byte gate on the release profile (runtime 23,360, 21,253, 23,710 and 19,760 bytes at `969bcc6`); the Core, Math, Gate, the wrapper and the eight adapters are measured by the same step, and all 16 artefacts are under the 24,576-byte wall (§16.3). The default and release profiles carry the same compiler options. | `DeployedSizeGate`; the CI size guard (fails at 24,000 bytes of runtime); `profile_parity.py` (§15.1: the suite itself is not run on the release profile in CI) | | INV-23 | On every staking entry point that wears `conserves`, balance plus debt plus recorded bad debt changes by the same amount as stake plus both reserves plus distributed-but-unpaid rewards, within 1e10 wei (E35). | Staking `conserves`, L467–505 → `Staking__InvariantBreached` | | INV-24 | The emission calendar closes exactly at `TOTAL_REWARDS`: `BASE_REWARDS + S − (S >> EMISSION_PERIODS) = TOTAL_REWARDS`, with remainder zero (E27); cumulative funding never exceeds `TOTAL_REWARDS`; no emission window pays more than `rewardReserve` holds (E28). | `_emittedAt` L1665–1675; `fundEmission` L564 → `Staking__CapExceeded`; `_updateGlobal` L1620 | | INV-25 | Every realised loss — a liquidation shortfall, an under-water emergency exit, the `syncEquity` write-off of an under-water position in an emergency, uncollectible interest — draws on `protocolReserve` first; only the uncovered rest is added to `totalBadDebt` (E37). | Staking L1252–1257, L844–849, L748–751, L1938–1946 | | INV-26 | While the balance plus 1e10 is below `owed`, no deposit, borrow, withdrawal, reward or pure-yield claim, reserve withdrawal or emergency cancellation executes (E36). | `_hardBreach` gates L898, L968, L1040, L1069, L1084, L595, L686 → `Staking__InvariantBreached`; at L1791 a pure-yield settlement is credited to `_rewardDeferred` instead of paid | | INV-27 | `absorbBadDebt` moves no BZPX out, pays the caller nothing, and lowers `totalBadDebt` by at most its current value: the reserve first, the caller's amount capped at the uncovered rest (E38). | `absorbBadDebt` L711–720 | | INV-28 | The totals of emission weight, pure-yield weight and positive equity are written only by `_applyBoost`, which replaces a position's tracked term with its recomputed one; a lock earns boost only while it is in force (E30). | `_applyBoost` L2020–2028; `_effectiveLockDays` L1972–1975 | | INV-29 | A borrow executes only if the new debt is at most half of the position's net stake before it and the book's utilisation after it is at most 75 % (E41). | `borrow` L974 → `Staking__LTVExceeded`; L978–980 → `Staking__UtilTooHigh` | | INV-30 | An emergency exit pays at most the position's net equity and at most the contract's balance, scaled by pot/E′ when the balance is short of the tracked equity (E40). | `emergencyWithdraw` L821–835 | | INV-31 | No withdrawal, pure-yield claim or lock change executes within `MIN_DEPOSIT_BLOCKS` = 10 blocks of the position's last deposit. | L1031, L1083, L1112 → `Staking__FlashLoanProtection` | ### B.2 The catalogue of stateful invariants The DEX repository at `969bcc6` has 54 `invariant_*` functions in 18 files (the README says 54); the staking repository at `9958d5f` has 22 in 6 files. The tables list each by file, line and name. The column *Numbered invariant* is filled only where B.1 already cites the campaign by name. The column *Mutant on record* is filled only from the mutant measurement of 2026-09-05 in `docs/assurance/ASSURANCE.md` §4l (fifteen mutants, each run against every invariant then in the repository, 40 in 14 campaigns; eleven noticed on the first run; three of the other four gained, in their campaigns, the action they lacked and then killed their mutants; the fourth, the post-fee `userMinOut` check halved, survives by design, since no campaign universe reaches that guard and two unit mutants watch it instead). An invariant with a dash has no mutant named for it in that section: that is a statement about the record, not a finding that none exists. The curated mutation guard as a whole has 1,895 entries (§15.2). **DEX campaigns.** | File (in `test/`) | Line | Invariant | Numbered invariant | Mutant on record | |---|---|---|---|---| | `AtqGateLifecycle.invariant.t.sol` | 209 | `invariant_AtqGateLifecycleMirror` | — | — | | `AtqHubRegistry.invariant.t.sol` | 186 | `invariant_AtqHubRegistryMirror` | — | — | | `AtqLedgerContext.invariant.t.sol` | 647 | `invariant_AtqRouterStateMachine` | — | — | | `AtqPoolClock.invariant.t.sol` | 218 | `invariant_AtqPoolClockLaws` | — | — | | `BlazePhoenixRouter.invariant.t.sol` | 402 | `invariant_RouterHoldsNothing` | INV-1 | the final transfer pays one wei less | | `BlazePhoenixRouter.invariant.t.sol` | 414 | `invariant_FeeNeverExceedsProtocolMax` | — | the protocol fee doubles | | `BlazePhoenixRouter.invariant.t.sol` | 424 | `invariant_FeeNeverEscapes` | — | the input-side fee is never charged | | `BlazePhoenixRouter.invariant.t.sol` | 435 | `invariant_SettledSwapEmitsExactlyOneFee` | INV-20 | — | | `BlazePhoenixRouter.invariant.t.sol` | 441 | `invariant_DeliveredNeverBelowTheProtocolFloor` | — | the protocol floor is halved (`FLOOR-half`) | | `BlazePhoenixRouter.invariant.t.sol` | 447 | `invariant_TwoHopFeeShapeFollowsTheRule` | — | — | | `BlazePhoenixRouter.invariant.t.sol` | 451 | `invariant_FeeIsChargedOnExactlyOneSide` | — | the fee is charged on both sides | | `BlazePhoenixRouter.invariant.t.sol` | 462 | `invariant_DeliveredNeverBelowUserMinOut` | — | — | | `DirtyWorld.invariant.t.sol` | 825 | `invariant_DirtyWorld` | — | — | | `FullStackLoop.invariant.t.sol` | 394 | `invariant_TokenConservation` | — | 30 % of every fee goes to a dead address | | `FullStackLoop.invariant.t.sol` | 412 | `invariant_RouterHoldsNothing` | INV-1 | the final transfer pays one wei less | | `FullStackLoop.invariant.t.sol` | 423 | `invariant_RegistryNeverExceedsMaxSlots` | INV-8 | — | | `FullStackLoop.invariant.t.sol` | 437 | `invariant_ActiveEntriesResolveToRealPools` | — | — | | `FullStackLoop.invariant.t.sol` | 456 | `invariant_SettledPlansOnlyTouchAttestedPools` | — | — | | `HubInvariantFromV1.t.sol` | 200 | `invariant_neverExceedsMaxSlots` | INV-8 | `MAX_SLOTS` becomes 17 | | `HubInvariantFromV1.t.sol` | 207 | `invariant_ActiveEntriesTradeThePair` | INV-19 | `recordSwap`'s pair-proof is removed (`INVARIANT-AIMED PAIRPROOF-off`) | | `HubInvariantFromV1.t.sol` | 216 | `invariant_activePoolsResolve` | — | — | | `OnlyControlOneBody.t.sol` | 391 | `invariant_OnlyControl_ADoorOpensOnlyToTheModelsLiveAdmin` | — | — | | `QuoterPreviewDelivery.invariant.t.sol` | 167 | `invariant_accountingNeverDrifts` | — | — | | `QuoterPreviewDelivery.invariant.t.sol` | 173 | `invariant_encodeAgreesWithPreview` | — | — | | `QuoterPreviewDelivery.invariant.t.sol` | 179 | `invariant_canExecuteSettlesAtItsFloor` | — | — | | `QuoterPreviewDelivery.invariant.t.sol` | 185 | `invariant_exactOutIsAFloorTheRouterHonours` | — | — | | `RouterAdversarialInvariantFromV1.t.sol` | 319 | `invariant_conservationA` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialInvariantFromV1.t.sol` | 322 | `invariant_conservationB` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialInvariantFromV1.t.sol` | 325 | `invariant_conservationH` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialInvariantFromV1.t.sol` | 328 | `invariant_routerHoldsNothing` | INV-1 | the final transfer pays one wei less | | `RouterAdversarialMultiHopFromV1.t.sol` | 123 | `invariant_conservationA` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialMultiHopFromV1.t.sol` | 124 | `invariant_conservationB` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialMultiHopFromV1.t.sol` | 125 | `invariant_conservationC` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialMultiHopFromV1.t.sol` | 128 | `invariant_routerHoldsNothing` | INV-1 | the final transfer pays one wei less | | `RouterAdversarialV4FromV1.t.sol` | 281 | `invariant_conservationA` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialV4FromV1.t.sol` | 284 | `invariant_conservationB` | — | 30 % of every fee goes to a dead address | | `RouterAdversarialV4FromV1.t.sol` | 287 | `invariant_routerHoldsNothing` | INV-1 | the final transfer pays one wei less | | `RouterAdversarialV4FromV1.t.sol` | 291 | `invariant_reentrancyBlocked` | — | the reentrancy lock no longer refuses | | `RouterMultiHopInvariantFromV1.t.sol` | 131 | `invariant_routerHoldsNothing` | INV-1 | the final transfer pays one wei less | | `RouterMultiHopInvariantFromV1.t.sol` | 143 | `invariant_conservationA` | — | 30 % of every fee goes to a dead address | | `RouterMultiHopInvariantFromV1.t.sol` | 144 | `invariant_conservationB` | — | 30 % of every fee goes to a dead address | | `RouterMultiHopInvariantFromV1.t.sol` | 145 | `invariant_conservationC` | — | 30 % of every fee goes to a dead address | | `RouterSplitInvariantFromV1.t.sol` | 121 | `invariant_routerHoldsNothing` | INV-1 | the final transfer pays one wei less | | `RouterSplitInvariantFromV1.t.sol` | 132 | `invariant_conservationA` | — | 30 % of every fee goes to a dead address | | `RouterSplitInvariantFromV1.t.sol` | 133 | `invariant_conservationB` | — | 30 % of every fee goes to a dead address | | `RouterStatefulConservationFromV1.t.sol` | 108 | `invariant_conservationA` | — | 30 % of every fee goes to a dead address | | `RouterStatefulConservationFromV1.t.sol` | 115 | `invariant_conservationB` | — | 30 % of every fee goes to a dead address | | `SqSameAnswer.t.sol` | 596 | `invariant_Sq_BothSolversAnswerTheSameBytes` | — | — | | `StrandedRegime.invariant.t.sol` | 306 | `invariant_StrandedMoneyIsNeverSwept` | — | the input-residual or bridge-residual sweep ignores its baseline (`SWEEP-bridge-nobase`) | | `StrandedRegime.invariant.t.sol` | 315 | `invariant_HoldsNothingBeyondTheSeed` | INV-1 | the final transfer pays one wei less | | `StrandedRegime.invariant.t.sol` | 322 | `invariant_DivergentLegNeverSettles` | — | the leg-pair guard admits a leg on the wrong pair (`LEG-pair-and`) | | `StrandedRegime.invariant.t.sol` | 330 | `invariant_PausedRouterNeverSettles` | — | `whenLive` no longer checks `paused` | | `StrandedRegime.invariant.t.sol` | 335 | `invariant_LedgerConservationA` | — | 30 % of every fee goes to a dead address | | `StrandedRegime.invariant.t.sol` | 343 | `invariant_LedgerConservationT` | — | — | **Staking campaigns** (file in `test/`). | File | Line | Invariant | Mutant on record | |---|---|---|---| | `BlazePhoenixStaking.t.sol` | 447 | `invariant_solvent` | — | | `BlazePhoenixStaking.t.sol` | 451 | `invariant_conservationBit` | — | | `BlazePhoenixStaking.t.sol` | 455 | `invariant_boostBounded` | — | | `BlazePhoenixStaking.t.sol` | 461 | `invariant_backingCoversOwed` | — | | `BlazePhoenixStaking.t.sol` | 472 | `invariant_everyLiveCommitmentIsTracked` | — | | `BlazePhoenixStaking.t.sol` | 482 | `invariant_lockRegistryHasNoDuplicates` | — | | `BlazePhoenixStaking.t.sol` | 493 | `invariant_staleBoostExcessIsBounded` | — | | `InvariantsFullSurface.t.sol` | 278 | `invariant_INV16_conservationIdentityHoldsExactly` | — | | `InvariantsFullSurface.t.sol` | 307 | `invariant_INV16_backingCoversOwed` | — | | `InvariantsFullSurface.t.sol` | 338 | `invariant_totalStakedShortfallIsExplainedByUncollectedInterest` | — | | `InvariantsFullSurface.t.sol` | 386 | `invariant_STAKEATTR_stakeLedgerIsExact` | — | | `InvariantsFullSurface.t.sol` | 401 | `invariant_INV18_lapsedLockPaysBaseBoost` | — | | `InvariantsFullSurface.t.sol` | 421 | `invariant_INV20_breakerCannotTripWhileSound` | — | | `InvariantsFullSurface.t.sol` | 426 | `invariant_INV19_debtNeverExceedsStake` | — | | `InvariantsFullSurface.t.sol` | 441 | `invariant_EQUITYFRESH_accumulatorIsTheSumOfStoredPositiveEquity` | — | | `InvariantsFullSurface.t.sol` | 553 | `invariant_EQUITYFRESH_EMG_accumulatorIsTheStoredSumThroughEverySyncAndExit` | — | | `assurance/EmissionScheduleMatrix.t.sol` | 519 | `invariant_DistributedNeverExceedsTheScheduleWhichNeverExceedsTotalRewards` | — | | `assurance/EmissionScheduleMatrix.t.sol` | 527 | `invariant_ReservePlusDistributedIsAlwaysWhatWasFunded` | — | | `atq/AtqEmergencySurface.invariant.t.sol` | 223 | `invariant_AtqEmergencySurfaceKeepsTheBooksUpToTheSimulatedLoss` | — | | `attack/EmissionShareInvariant.t.sol` | 127 | `invariant_ATK_INV_paidLeDistributedLeCurveLeCap` | — | | `attack/EmissionShareInvariant.t.sol` | 142 | `invariant_ATK_INV_noActorAboveItsShare` | — | | `hunt/ExactAttributionInvariant.t.sol` | 104 | `invariant_campaignActuallyGeneratesDebt` | — | The mutant column is a mapping by invariant from the measurement of 2026-09-05, and it covers the DEX only: a dash means that no mutant is recorded against that invariant, not that none exists. The 22 staking invariants carry no such mapping. ### B.3 Symbolic proofs (Halmos) Fifteen Halmos checks of the DEX repository report `[PASS]` in the CI run at commit `6387350`. Halmos executes each check symbolically over the compiled bytecode, for every input that satisfies the check's stated preconditions. The eight in `CoreFormalGateSpec` and `EffV4FeeFormalSpec` are the CI gate. The column *Code under check* names the function the check calls, with its line in `src/` at `6387350`. | File (in `test/formal/`) | Line | Check | Property | Code under check | |---|---|---|---|---| | `CoreFormalGateSpec.t.sol` | 30 | `check_ironFloorBps_boundsUnconditional` | For every impact, leg count and $\sigma$: $8{,}000 \le \mathtt{ironFloorBps} \le 9{,}600$ | Core `ironFloorBps` (:3402) | | `CoreFormalGateSpec.t.sol` | 40 | `check_impactV2Bps_neverExceedsBPS` | For every amount and reserve, the V2 impact is at most 10,000 bps | Core `impactV2Bps` (:3412) | | `CoreFormalGateSpec.t.sol` | 53 | `check_outV3_failClosedGuards` | A zero amount, zero liquidity, zero price or a fee of at least $10^{6}$ quotes 0 | Core `outV3` (:1431) | | `EffV4FeeFormalSpec.t.sol` | 22 | `check_staticKeyIsTruthWithoutProtocolFee` | A static key with no protocol fee in the swap's direction returns the key fee verbatim; the `slot0` LP fee is ignored | Core `effV4Fee` (:2244) | | `EffV4FeeFormalSpec.t.sol` | 33 | `check_staticKeyComposesProtocolFee` | With a protocol fee $p$ in the swap's direction, a static key composes $p + f - \lfloor p f/10^{6} \rfloor$: never below the key fee, never above the key fee plus $p$, and never in the unquotable band for any LP fee the manager admits | Core `effV4Fee` (:2244) | | `EffV4FeeFormalSpec.t.sol` | 46 | `check_dynamicProtoFeeFailsClosed` | A dynamic-fee key with any non-zero protocol fee resolves to at least $10^{6}$ (unquotable) | Core `effV4Fee` (:2244) | | `EffV4FeeFormalSpec.t.sol` | 53 | `check_dynamicUsesMeasuredLpFee` | A live dynamic-fee pool (no protocol fee) prices from the `slot0` LP fee | Core `effV4Fee` (:2244) | | `EffV4FeeFormalSpec.t.sol` | 59 | `check_sentinelNeverSurvivesForLivePool` | The dynamic-fee sentinel is never the resolved fee of a live pool | Core `effV4Fee` (:2244) | | `CompositionFormalSpec.t.sol` | 32 | `check_depthIsShortSide` | For non-zero liquidity and price, the token-denominated depth of a concentrated-liquidity pool is at most both virtual reserves, $\lfloor L Q_{96}/\sqrt{P} \rfloor$ and $\lfloor L\sqrt{P}/Q_{96} \rfloor$ | Core `depthFromL` (:1231), mirrored in the file | | `CompositionFormalSpec.t.sol` | 44 | `check_depthEqualsLiqAtUnitPrice` | At $\sqrt{P} = Q_{96}$ the depth equals $L$ | Core `depthFromL` (:1231), mirrored in the file | | `SolverBandFeeDustFormalSpec.t.sol` | 78 | `check_lemmaMulmodFits` | Lemma L0: for $a, b < 2^{128}$, $\mathrm{mulmod}(a, b, 2^{256}-1) = ab$, so the high word of `mulDiv` is 0 and its 512-bit branch is not taken | integer lemma on the guard of Core `mulDiv` (:491) | | `SolverBandFeeDustFormalSpec.t.sol` | 86 | `check_lemmaHopFeeIsCeiling` | Lemma CEIL: for $b < 2^{128}$, the code's fee satisfies $28b \le 10^{4}\,\mathrm{fee} < 28b + 10^{4}$, that is $\mathrm{fee} = \lceil 28b/10^{4} \rceil$ | Core `mulDivUp` (:531) | | `SolverBandFeeDustFormalSpec.t.sol` | 121 | `check_bandNoBaseAndDeadRow` | With no base row ($b \ge n$) the band keeps nothing; a row priced 0 is never kept | Math `_inBand` (`BlazePhoenixMath.sol`:511) | | `SolverBandFeeDustFormalSpec.t.sol` | 149 | `check_hopFeeRoundsUpAndNetMatches` | Given L0 and CEIL (the two checks above), for every $b < 2^{128}$: $b > 0 \Rightarrow \mathrm{fee} > 0$; $b \ge 2 \Rightarrow \mathrm{fee} < b$; the Core's one-hop net of the input fee equals $\lfloor \mathrm{base}\,(b - \mathrm{fee})/b \rfloor$ | Core `mulDivUp` (:531), `netOfInputFees` (:461) | | `SolverBandFeeDustFormalSpec.t.sol` | 182 | `check_dustProbeV2FloorsToZero` | The Solver's dust probe ($m/100$, or $m$ when that is 0) is at least 19 wei for $m \ge 1{,}900$; a 1-wei constant-product quote at 30 bps and price at most 1 is 0 | Core `outV2` (:1398) | ### B.4 Properties of the compiled artefact The DEX repository's `assurance metrics` workflow (`.github/workflows/assurance.yml`, line 57) runs `.github/scripts/assurance/bytecode_invariants.py` over the runtime bytecode of every `BlazePhoenix*` contract the build produces, and the step fails if any of the seven properties below does not hold. The script reads opcodes by walking the code with PUSH data skipped, so a constant is never read as an instruction. Lines are those of the script at `6387350`, where the workflow passes. | Line | Property | |---|---| | 43 | No runtime contains `SELFDESTRUCT`. | | 44 | No runtime contains `CALLCODE`. | | 45 | No runtime contains `ORIGIN`: `tx.origin` is no authority anywhere in the system. | | 67–74 | `BlazePhoenixMath`, the library the other contracts reach by `DELEGATECALL`, contains none of `SSTORE`, `TSTORE`, `CREATE`, `CALL`, `DELEGATECALL` and `CREATE2`. | | 155–166 | Every function selector the ABI declares appears as a constant in the runtime dispatcher: no declared function is unreachable. | | 167–191 | Every refusal `revert E(n)` in a contract's source file has its code $n$ as a push immediate in that contract's runtime, so no refusal the source contains was removed by the optimiser. | | 213–214 | The Router's runtime contains `TLOAD` and `TSTORE`: the reentrancy lock and the fee-on-transfer probes are transient. | ### B.5 Specified properties This table states each property and where it is specified; the guarantees of this paper are the invariants of B.1 and the entries of B.2–B.4. The Certora rules are in `certora/specs/` of the DEX repository at `6387350`, each run by the configuration of the same name in `certora/conf/` (`effv4fee.conf`, `floorsfee.conf`, `router-control.conf`, `router-swap.conf`); the Halmos checks are in `test/formal/` of the DEX repository at `6387350` and of the staking repository at `9958d5f`. | Specified in | Line | Rule or check | Property | |---|---|---|---| | `EffV4Fee.spec` | 27 | `staticKeyIsTruthWithoutProtocolFee` | A static key with no protocol fee in the swap's direction returns the key fee verbatim. | | `EffV4Fee.spec` | 35 | `staticKeyComposesProtocolFee` | With a protocol fee $p$, a static key resolves to $r = p + f - \lfloor p f/10^{6} \rfloor$, with $f \le r \le f + p$ and $r \le 10^{6}$. | | `EffV4Fee.spec` | 47 | `dynamicWithProtoFeeFailsClosed` | A dynamic-fee key with any protocol fee resolves to the unquotable value ($\ge 10^{6}$). | | `EffV4Fee.spec` | 55 | `dynamicUsesMeasuredLpFee` | A live dynamic-fee pool prices from the `slot0` LP fee. | | `EffV4Fee.spec` | 60 | `sentinelNeverSurvivesForLivePool` | The dynamic-fee sentinel is never the resolved fee unless `slot0` reports it. | | `FloorsFee.spec` | 25 | `constantsArePinned` | BPS = 10,000; protocol fee 28 bps; leg floor 8,000 bps; floor base 9,600 bps; hard maximum loss 2,000 bps. | | `FloorsFee.spec` | 37 | `protocolFeeIsCeilOf28Bps` | $\mathrm{fee} = \lceil 28\,\mathrm{base}/10^{4} \rceil$. | | `FloorsFee.spec` | 45 | `protocolFeePaysAndNeverSwallows` | $\mathrm{base} > 0 \Rightarrow \mathrm{fee} > 0$; $\mathrm{base} \ge 2 \Rightarrow \mathrm{fee} < \mathrm{base}$. | | `FloorsFee.spec` | 53 | `protocolFeeMonotone` | A larger base never gives a smaller fee. | | `FloorsFee.spec` | 61 | `legFloorIsCeil80` | The leg floor is $\lceil 0.8 \cdot \mathrm{bound} \rceil$ and never above the bound. | | `FloorsFee.spec` | 71 | `legFloorMonotone` | A larger bound never lowers the leg floor. | | `FloorsFee.spec` | 79 | `hopRuleCollapsesToLegFloorAtN1` | For one leg, the hop rule is equivalent to the leg floor. | | `FloorsFee.spec` | 86 | `hopSlackNeverExceedsOneAverageLeg` | $n$ times the slack is at most 20 % of the hop bound. | | `FloorsFee.spec` | 96 | `moreLegsNeverLoosensHopSlack` | More legs only tighten the slack. | | `FloorsFee.spec` | 103 | `hopBarMonotoneInBound` | A larger hop bound never lowers the bound minus the slack. | | `FloorsFee.spec` | 113 | `ironFloorBounds` | $8{,}000 \le \mathtt{ironFloorBpsShv} \le 9{,}600$. | | `FloorsFee.spec` | 123 | `ironFloorMonotoneInShaves` | The floor is non-increasing in impact, leg shave and $\sigma$. | | `FloorsFee.spec` | 130 | `ironFloorCountFormBounds` | The leg-count form of the floor lies in $[8{,}000, 9{,}600]$. | | `RouterControl.spec` | 53 | `controlGateOnSetters` | A control-only setter succeeds only from the admin, and only before renunciation. | | `RouterControl.spec` | 62 | `configOnlyByControl` | Configuration changes only through control; a treasury slot also through its holder. | | `RouterControl.spec` | 79 | `renounceIsForever` | Once `controlRenounced` is true it stays true. | | `RouterControl.spec` | 87 | `renounceRefusedWhilePaused` | Renunciation reverts while the Router is paused. | | `RouterControl.spec` | 95 | `neverPausedAndRenounced` (invariant) | Paused and renounced are never both true. | | `RouterControl.spec` | 101 | `queueSetsFortyEightHourEta` | A queued rescue becomes executable 48 hours after it is queued. | | `RouterControl.spec` | 109 | `rescueTimelockAndSingleUse` | A rescue executes only if queued, only after its delay, and only once. | | `RouterControl.spec` | 118 | `rescueNeverTakesOwedFees` | A rescue never takes the fees owed to the treasuries. | | `RouterSwap.spec` | 58 | `zeroMinOutRefused` | A zero `userMinOut` is refused at every door. | | `RouterSwap.spec` | 76 | `amountInAboveU128Refused` | An `amountIn` above $2^{128}-1$ is refused. | | `RouterSwap.spec` | 94 | `pausedBlocksEverySwapDoor` | While the Router is paused, every swap door reverts. | | `RouterSwap.spec` | 104 | `deliveryAtLeastMinOutOrRevert` | A one- or two-hop swap pays at least `userMinOut` or reverts. | | `RouterSwap.spec` | 118 | `routerHoldsNothing` | After a swap the Router holds none of the swapped tokens beyond the fees it owes. | | `CompositionFormalSpec.t.sol` | 62 | `check_hopCollapsesToLegFloorAtN1` | For one leg, the hop rule is equivalent to the leg floor. | | `CompositionFormalSpec.t.sol` | 71 | `check_slackNeverExceedsOneAverageLeg` | $n$ times the slack never exceeds one fifth of the hop bound. | | `CompositionFormalSpec.t.sol` | 80 | `check_moreLegsNeverLoosensBudget` | More legs only tighten the slack. | | `CoreFormalSpec.t.sol` | 33 | `check_outV2_neverReachesReserveOut` | For a non-zero input and non-zero reserves in the `uint112` range and a fee of at most 1,000 bps, the constant-product output is strictly below the output reserve. | | `CoreFormalSpec.t.sol` | 49 | `check_outV3_zeroForOne_boundedByVirtualReserve` | The in-tick output never exceeds the virtual reserve $L\sqrt{P}/Q_{96}$. | | `CoreFormalSpec.t.sol` | 63 | `check_mulDiv_matchesExactWhenNoOverflow` | For $a, b$ in the `uint128` range and $d > 0$, `mulDiv` equals $\lfloor ab/d \rfloor$. | | `MathLibFormalSpec.t.sol` (staking) | 40 | `check_SafeIsZeroWhenAnyOperandIsZero` | `mulDivSafe` returns 0 when any operand is 0. | | `MathLibFormalSpec.t.sol` (staking) | 48 | `check_MulDivReturnsForNonZeroDenominatorInWordRegime` | For `uint128` operands and a non-zero denominator, `mulDiv` returns. | | `MathLibFormalSpec.t.sol` (staking) | 61 | `check_AgreesWithPlainDivisionInWordRegime` | For `uint128` operands, `mulDiv` equals plain integer division. | | `MathLibFormalSpec.t.sol` (staking) | 71 | `check_SafeAgreesWithUnsafeInWordRegime` | For `uint128` operands, `mulDivSafe` and `mulDiv` agree. | | `MathLibFormalSpec.t.sol` (staking) | 78 | `check_DivideByOwnFactorIsIdentity` | $\mathrm{mulDiv}(a, b, b) = a$ for $b \ne 0$. | ## Appendix C · Reproduction commands Every number in this paper that comes from the DEX repository is reproduced by one of the commands in the first block, run from a clean checkout of `Blaze-Phoenix-Dex` at `969bcc6` (at `6387350` for the figures the text dates at that commit) with Foundry and Python 3 installed; fork suites need an archive RPC key in `DRPC_KEY`. The numbers of the staking engine (§25) are reproduced by the second block, from a clean checkout of `Blaze-Phoenix-Staking` at `9958d5f`. Where a figure of the previous edition was measured at an earlier commit and not run again at `969bcc6`, the text of its section says so, and the command here is the way to run it again. ```bash forge test --no-match-path 'test/fork/**' # the suite, release settings (§15.1) forge test --match-path 'test/fork/**' # the fork lane (§15.1, §17) FOUNDRY_PROFILE=release forge build --sizes --skip test --skip script # sizes against EIP-170 (§16.3) python3 .github/scripts/mutants.py # the curated mutation guard (§15.2) python3 .github/scripts/check_targets.py # every mutant still points at one line python3 .github/scripts/assurance/covering_array.py --check # both covering arrays current (§15.4) forge test --match-contract RegimeCoverageTest -vv # strength 2 forge test --match-contract RegimeCoverageT3Test -vv # strength 3 forge test --match-path test/regime/HostileVenueMatrix.t.sol # ten pathologies × two doors (§15.5) forge test --match-path test/regime/SandwichCurve.t.sol -vv # the sandwich curve (§14.3) forge test --match-path test/regime/CanonicalOracles.t.sol # the quote maths against the specifications (§15.6) forge test --match-path 'test/*MetamorphicRelations.t.sol' # the metamorphic relations (§15.7) FOUNDRY_PROFILE=nver1 forge build --skip '*.t.sol' && FOUNDRY_PROFILE=nver2 forge build --skip '*.t.sol' && FOUNDRY_PROFILE=nver3 forge build --skip '*.t.sol' NVERSION_LANE=1 forge test --match-path 'test/nversion/*' # the binaries agree (§15.8) forge test --match-test invariant_ --fuzz-seed 0xb1a2ef00 # the stateful campaigns (§15.3, Appendix B.2) forge test --match-path test/FeeSeals.t.sol # the fee rule, both regimes (§13.4) forge test --match-path test/QuoteDelayStatistics.t.sol -vv # how a quote ages (§12.2) forge test --match-path test/QuoterGasStatistics.t.sol -vv # what a quote costs (§12.3) forge test --match-path test/fork/QuoteDelayFork.t.sol -vv # live Base, 1,000 USDC → WETH (§12.2) forge test --match-path test/fork/FidelityMatrix.t.sol -vv # preview → delivery (§17.2) forge test --match-path test/fork/DiscoveryColdWarm.t.sol -vv # cold and warm legs, no gas (§17.4) forge test --match-path test/EquationBench.t.sol -vv # ρ* (§17.6) forge test --match-path 'test/fork/Deployed*.t.sol' # what V1 is, pinned by codehash (§19) python3 .github/scripts/assurance/projection_distance.py # the projection-distance table (§15.9) python3 .github/scripts/assurance/profile_parity.py # the default and release profiles carry the same options (INV-22) python3 .github/scripts/assurance/metrics.py # every assurance number, with its denominator bash .github/scripts/shared-quantities.sh # the register agrees with the tree (Appendix D) ``` ```bash # Blaze-Phoenix-Staking at 9958d5f forge test # the staking suite (§25.7) forge test --match-test invariant_ # the invariant campaigns (Appendix B.2) forge test --match-path test/assurance/EmissionScheduleMatrix.t.sol # the emission calendar (E27, E28, INV-24) ``` The curated mutation guard (`mutants.py`) lists 1,895 mutants at `969bcc6`, counted from the list in the script; a mutant is a small change, usually to a single line (1,692 of the 1,895 replace exactly one non-blank line) and to the contracts (1,865 of the 1,895 edit a file under `src/`), that a named test must turn red. The hashes of Worked example 4 are reproduced by any keccak-256 implementation over `abi.encode(currency0, currency1, fee, tickSpacing, hooks)`; the paper's figures were produced with a pure-Python Keccak-f[1600] checked against the empty-string and `"abc"` test vectors and against the `extsload(bytes32)` selector the Core hard-codes. ## Appendix D · The shared-quantity catalogue The project's rule is *one question, one producer*: a quantity that more than one place produces or consumes either collapses to a single producer, guarded in CI against copies, or keeps its producers and carries a named test that asserts they agree. The register that enumerates them (`SHARED_QUANTITIES.md` in the DEX repository at `969bcc6`) holds 131 rows (134 at `6387350`: the three added since are the route's floor rate `BPC.routeFloorBps`, the encode door's `finalHopQuote` read through `Quoter._askLeg`, and the funnel's horizon `FUNNEL_STRETCHES`). This appendix gives the public form of it: each quantity, the question it answers, and its producer. The register's status and pin columns are not reproduced here, because a status is a claim about the day it was written; read them in the repository at the commit you are checking. The staking repository keeps its own register (37 rows at `9958d5f`; §25.7). **Floors and fees.** | Quantity | The question it answers | Producer | |---|---|---| | `LEG_FLOOR_BPS` | "How much may a single leg legitimately lose?" | `Core` | | hop commitment (`Σ leg.amountIn`) | "How much does this hop commit to trade?" | `Router._legSum` | | fee count per settlement | "Did this swap pay the protocol — once on an anchored route, once per hop on an exhausted one?" | `Router._payFee` counts into a transient slot, `Router._execute` reads it once at settlement: zero → `RouterE(15)`, more than one on an anchored route → `RouterE(16)`. | | `owed` (a fee share the payee refused, seal 2026-10-21) | "Whose is the fee share a push could not deliver, and may a swap see it?" | `Router._push` books it | | Router balance after settlement (`RouterBalanceAfterSettlement`, header R1) | "What may the Router still hold when a swap ends?" | every payout of `Router._execute` | | `PROTOCOL_FEE_BPS` | "How much does the protocol take?" | `Router._chargeHopFee` ×2, `Quoter._pack` ×1, `Quoter.previewPlanExact` ×2 | | `effV2Fee` / `quoteV3Fee` | "What fee does this pool actually charge?" | `Core` only | | `ironFloorBps` **impact input** | "What is this route's price impact?" | `Solver` ×2 | | `expectedOut` of a single-tick leg (the per-leg attestation) | "What can this leg be promised to deliver?" - and, from the walk (2026-09-24) until S2 (2026-10-11), the same answer to "which venue delivers more?". **Since S2 (V4 fragmentation, reported by Seavia Resources) the two questions have two figures:** the promise stays the sixteen-stretch walk, a floor an outsider can only lower (safe for a promise); the ranking is `rank` from `Core.v4WalkRank`. | produced by `Core.universalQuote`'s V4 arm through `Core.v4WalkOut`, the pool's own swap walked over its initialized ticks. | | `v4WalkOut` (what a V4 pool pays for an input) | "What does this V4 pool pay for this amount?" | `Core.v4WalkOut` | | promise of a capacity-held concentrated leg (`MAX_CONC_DRAIN_BPS`, 2026-10-22) | "What is a leg promised when the capacity bound holds its promise but not its input?" | `Solver._capacity`, at both commit sites | | `v3PaysOnBudget` (what a V3-shaped pool pays for an input, on a budget of reads; DEX-01 / 3331, 2026-10-27) | "What may a concentrated leg be promised, and what does the Router quote for it in frame?" | `Core.v3PaysOnBudget` | | the price a concentrated range lands on for an exact input (`_nextSqrtFromInput`; 1 wei of rounding, 2026-11-10) | "Where does this range's price land when this input enters it?" | `Core._nextSqrtFromInput` | | `_v4Quote` on a dynamic-fee key whose hook runs beforeSwap (the LP fee the swap charges) | "What LP fee does this V4 swap pay?" | Two producers that cannot agree: the quote reads slot0's `lpFee` through extsload (`Core.effV4Fee`), the PoolManager charges the fee the hook RETURNS from beforeSwap on a dynamic key (v4-core `Pool.swap`: the override wins over slot0). | | `sqrtPriceAtTick` (the price at a tick) | "Where does a tick's price lie?" | `Core.sqrtPriceAtTick` alone - the TickMath table, each constant derived from its definition | | `_askWord` (what one pool's answer may cost a quote) | "How much gas, memory and trust may one answer take from the planner?" | `Core._askWord` - a one-word ask with `GAS_CAP` of gas and one word copied, `ok` only for a full word | | `ASK_GAS_FLOOR` (the gas a one-word ask must hold; aero-nova, 2026-10-26) | "May a starved ask answer 'no'?" | `Core._askWord` alone, before its call: on less than `ASK_GAS_FLOOR` = 104 587 | | `getV3Fee` budget (`CL_FEE_COST`, `CL_FEE_WINDOW`, `CL_FEE_SPENT`, `CL_FEE_GAS`, `CL_FEE_TRUST`, `CL_FEE_FLOOR`; aero-nova, 2026-10-26) | "How much gas may one concentrated pool's fee() take, and when is its answer believed?" | `Core.getV3Fee` alone, on its own budget instead of the shared `GAS_CAP` | | `SOLVE_GAS` (what the in-transaction search may spend) | "Does the plan `swapBestExactIn` executes equal the plan `findBestRoutePlan` returns off-chain, and what happens when the search needs more gas than it is given?" | `Router.swapBestExactIn` calls `Solver.findBestRoutePlan` with a fixed `SOLVE_GAS` | | `hookPaused` (a listed hook whose code moved since its pin) | "May a leg through this hook execute?" | `Hub.hookPaused` | | `hookAltersDeltas` (a hook with its own accounting) | "May a leg through this hook execute?" | `Core.hookAltersDeltas` | | `_hookRefusedIn` (the Router's refusal of a leg, at the exact doors) | "Will the Router refuse this route before it moves a token (RouterE(3) shape, RouterE(9) hook, RouterE(11) key, RouterE(8) native side or no engine, RouterE(19) Gate wrapper not live)?" | `Quoter._hookRefusedIn` is the one producer the preview asks: `_pack` withholds `canExecute` with it, and `_exact` (both `previewPlanExact` and `previewRouteExact`) sets the exact scalar to zero with it. | | `deadline` at the encode doors | "Will the Router refuse this call before it moves a token (RouterE(4))?" | `Router._swap` | | `effectiveMinOut` at the encode doors (the floor inside the bytes) | "Will the Router refuse this call's delivery (RouterE(5))?" | `Router` | | `exactOut` with one pool twice in a hop | "What will the Router deliver for this route in this block?" | `Quoter._exact` prices every leg against the pool before the swap | | `_dropDust` (the funnel's dust rule: a row's measured depth against the rest of its pair) | "Which rows of a pair does the funnel quote?" | `Solver._dropDust`, in `Solver._rankedPools` on every pair with two rows or more: each row is measured by `Core.hopMass18` | | `hopMass18` (a hop's mass: the tokenOut a row can pay, in 18 decimals) | "How much of the bought token can this row pay?" | Two producers, one formula | | best single leg at full size (the min-split gate's reference) | "Is this split worth its legs?" | `Solver._buildHop`: every survivor of the band, including the ones the funnel cut dropped | | `MAX_ROUTE_IMPACT_BPS` (the route's ceiling on one leg's measured impact) | "Which leg is a destroyer?" | `Solver._assembleRouteMulti`, the one judge, refusing the route when any leg's impact (`_legImpactBps`: V3 through its fee, V2 by its input against its reserve) reaches it. | | band vote (whose mass may choose the band's base) | "Who votes the depth-weighted median?" | `Math._depthWeightedMedian`, masked by `Math._mutedVotes`: a live pair- or concentrated-shaped candidate whose row a swap wrote | | one price order per hop (`_byPrice`, M11, wave 5.2 gas, 2026-10-28; `_byRate`, by rate, until MED the same day) | "In which order do a hop's live prices stand, for its plain median and for every weighted median of the hop?" | `Math._byPrice`: one stable insertion sort of the live rows | | a venue's price as the band reads it (`Math._prices`, MED, 2026-10-28) | "Which price does the band compare, and with which fee and error bound?" | `Math._prices`: p = r * 1e6 / (1e6 - f), r the probe's rate after fee (the Solver's `rates[i]`), f the fee that probe was charged and e its error bound, both from `Core.universalProbe` and packed by the Solver into one word, `fe[i]`, the fee in bits 0-23 and e above. | | a row's error bounds `err` and `errOrder` (`Core.universalProbe`, ROUTEQ, 2026-11-13; two numbers) | "How far can this row's price sit from the spot at the probe, and how far can the base's fill of the WHOLE order fall under it?" | `Core.universalProbe(c, probe, bar, wantFee, orderIn)` returns both, in WAD, with the rounding terms rnd = (3 WAD + 2 probe) / rank + 1 at the probe in both. | | first stage of a bridge route (`_firstStage`, M10, wave 5.2 gas, 2026-10-28) | "What does the first stage tIn -> bs[i] build, in each topology that opens on bs[i]?" | `Solver._buildHop` builds it once per solve and `Solver._firstStage` keeps a copy in the pair's `_candsOf` entry | | remainder seat (the leg that takes what the shares leave over) | "Who absorbs the rounding and the input the capacity clamp frees?" | `Math._seatTheSplit`: the deepest survivor by measured weight, ties to the lowest address - never the funnel's psi order | | `sumPsi` (the split's denominator, S) | "Over what total are a split's shares floored, so that the remainder is never negative?" | `Math.select` returns it as the sum of psis[0..n) | | a leg's place in the split (`_placed`, EVERY LEG PAYS FOR ITS PLACE, 2026-10-28) | "Does this leg pay for its place in the split?" | `Solver._placed`: in a split of three legs or more, the leg whose probe paid least | | `QuoteDeltas` (the Quoter's dry-run payload) | "Is this revert data a quote?" | produced by the `Quoter` fallback | | `_inputTaxed` (the Quoter's input probe, at the exact doors) | "Will the pool receive less of this leg's input token than the Router pays it (RouterE(13))?" | `Router._v3Callback` pays a concentrated pool what it demands and refuses the leg when the pool's measured delta is short | | the net output the exact door promises (`exactOut` of `previewPlanExact` / `previewRouteExact`, 2026-11-13) | "What does the Router deliver for this route, in this block, after the fee the calendar names?" | `Quoter._fundedOut` prices the route as the Router funds it | | the fee walk (`Quoter._walk`, 2026-11-14) | "What does each hop of this route receive and yield once the calendar's input fee is taken where the Router takes it?" | `Quoter._walk`, the one producer for the exact pass of `_exact` | | `finalHopQuote` (the anchor of the protocol floor) | "What does the floor anchor on when the last hop measured nothing?" | `Router.swapExactIn`, hop loop: the last hop's in-frame quote, else its attested figure, else - when every leg of it is blind - the hop's declared `expectedOut`. | | `_cutByWeight` (which band survivors the leg budget keeps) | "Which pool does the funnel cut drop at equal weight?" | `Math._cutByWeight`: heaviest measured weight, then the better marginal rate | | `ExecutionProof.floorUsed` against `realized` | "Which floor did this settlement meet, in the units it delivered?" | `Router.swapExactIn`: `protocolFloorOut` is checked against `outCap`, the gross the venues declared, before the output-side fee and any transfer tax | | concentrated holdings cap (`registryDepth18`, concentrated arm) | "How much mass does a concentrated pool hold?" | `Core.registryDepth18` through `Core.heldMass18` | | `reservesHeld` / `heldBy` (does a reserve-shaped pool hold what it reports) | "May anything believe this pair's reserves?" | `Core.heldBy` | | `v4HeldShare` (a singleton book's vote: its depth scaled by the share of its virtual output side it holds) | "With how much depth does this V4 book vote in the band?" | `Core.v4HeldShare` | | `legQuoteImpact` (the in-frame quote and impact of a pair-shaped or concentrated leg; K2, 2026-10-21) | "What does this leg quote, and at what impact, as the frame executes it?" | `Core.legQuoteImpact` | | `_derivedByFactory` (admission requires proof of origin) | "May this pool take a seat through the swap door?" | `Hub.discoverFor` | | `_scanV4` (what a V4-derive row lists for a pair) | "Which V4 pools of this pair does discovery list?" | `Hub._scanV4`, called by `Hub.discoverFor` for each `MODE_V4_DERIVE` row: after the custody check | | `_pmHoldsNone` (does the PoolManager hold any of a token) | "Can any V4 pool of this pair pay this token out?" | `Hub._pmHoldsNone`, asked by `Hub._scanV4` before its first probe for each side that is neither a bridge nor WETH: the manager's unlock flag | | per-leg floor bound (`_execScaled` coverage gate) | "What does a leg's floor rest on when its attestation is low?" | `Router._execScaled`: `bound = max(attested, qs * MIN_QUOTE_COVERAGE_BPS / BPS)` where `qs` is the in-frame quote rescaled to the executed amount | | `MIN_QUOTE_COVERAGE_BPS` (5 000) | "Under what share of the in-frame quote may a leg's bound never rest?" | `Core` | | `residIn` (the route input the legs did not spend) | "Whose is the input that no leg consumed?" | two producers in `Router._execute`, one per route shape: the post-loop sweep (`tokenIn != tokenOut`) and, for a CYCLIC route (`tokenIn == tokenOut`), the refund at the start of hop 1 - after the loop residual and output are the same token and can no longer be told apart. | | a split's dust remainder (`m - Σ leg.amountIn` on one hop; FindingAnchorDonation, 2026-11-13) | "How much of an order may a split leave to no leg, and whose is it?" | `Solver._split`: a leg whose quote at its share is 0 is dropped and its share is not handed on, so `committedIn` < m | | `legOutRaw` (the token a leg delivers into) | "Which token does this leg produce?" | produced once per leg by `Router._legTokens` | | `declared` (the ceiling of a leg's measured delta) | "What did the venue say it paid the Router for this leg?" | produced per leg kind: `Router._execPairAmt` returns `outAmt`, the output the Router asks of the pair | | `outCap` (the ceiling of the swap's output delta) | "How much of the tokenOut the Router gained since `toutStart` is this swap's output?" | produced in `Router._execute`, from zero: a leg that makes tokenOut adds the `declared` its `_execScaled` returns | | `owned` (the bridge a later hop may spend) | "How much of the Router's balance of hop h>=1's input is this swap's?" | produced by `Router._owned` for two consumers: `_chargeHopFee` (the fee base of hop h>=1) and `_hopScaleImpactAndQuote` (`realIn`, the input hop h>=1 scales its legs to). | **Registry state (the Monoslot).** | Quantity | The question it answers | Producer | |---|---|---| | registry `fee` | "What fee should the planner assume for this pool?" | written by `Hub._register`, read by `Hub._readPoolInfo` → Solver/Quoter | | registry `hooks` | "Does this pool have a hook?" | written by the two doors that admit one, `Hub.addV4` and `Hub.seedPool`, each after `_admitOnRegistration` | | registry `tier` (Monoslot bits [47:40]) | "Did a curator vouch for this row?" | built by each registration door in `Hub._born(kind, fee, trusted)` and handed to `Hub._register` inside the born slot: `addV4` and `seedPool` | | `depthWad` (via `depthFromL18`) | "How deep is this pool?" | `Core` ×3 - the two arms of the quote body | | `bridged` (Monoslot bit 7) | "Is this pool anchored on a routable bridge?" | written frozen at registration | | `2_500`, the bridge term (+25 %) | "How much does a bridged pair add to a row's score?" | two producers, pinned by parity: `Core.psi` scores each incumbent | | `stable` | "Is this a stable-curve pool?" | the pool's own `stable()`, read once by `Core.solidlyStable` at the registration door | | pool depth **source** | "Who says how deep this pool is?" | `Router._recordHits` reads `getReserves` from the pool | | reserve-shaped leg promise vs `Holdings` | "Can this pair pay what its leg promises?" | the promise is `outV2`/Solidly on the pair's own `getReserves` | | `getReserves` word width (`Reserve`) | "Is this word a reserve at all?" | `Core.getReserves`, read by every reserve-shaped quote and by `Router._recordHits` | | `provenShape` (a non-V4 row's family) | "What family is this pool?" | `Core.provenShape` | | `solidlyAskOut` (what a Solidly pair is asked to pay) | "How much does a Solidly leg deliver, and so how much may it promise?" | `Core.solidlyAskOut` | | `_solY` exit (the replicated stable curve's output reserve, behind `outSolidlyStable`) | "Does the replicated stable curve leave K_post >= K_pre in contract arithmetic?" | `Core._solY` | | `single` (the min-split gate's reference) | "What would this order get from the best single pool?" | `Solver._buildHop` alone: every survivor of the band and the funnel is quoted at full size by `_singleLeg` | | `decIn1` / `decOther1` (a hop's two token decimals, +1 encoded in `QuoteCtx`) | "How many decimals do this hop's tokens have?" | read once per pair per solve by `Solver._rankedPools` | | `QuoteCtx` of a candidate (`xs`, a hop build's contexts) | "In which context does the Core quote this candidate?" | one producer, `Solver._ctx`, called once per candidate per build by `_buildHop` | | the G7 harness Hub's V4 derive row (`G7Deploy._v4Wire`; G7 robinhood midtail-1, 2026-11-14) | "Does the campaign's Hub run the V4 derive scan on this chain?" | `G7Deploy._v4Wire(PM, WETH, stable)` is the one producer in the harness: `hub.v4PoolManager` and one `addFactory` row with `KIND_V4` and `MODE_V4_DERIVE`, on every chain with a PoolManager (Optimism, Arbitrum, Robinhood since 2026-11-14; Base already). | **Identity and keys.** | Quantity | The question it answers | Producer | |---|---|---| | `computeV4PoolId` | "Which V4 pool is this leg talking about?" | `Core` | | `v4LegCurrencies` (the native side of a V4 leg) | "Which side of this native V4 leg is the chain's coin?" | `Core.v4LegCurrencies`, by orientation | | `nativeMapVerified` in the preview (#52, seal 2026-10-21) | "Will the Router accept this native V4 leg's key?" | `Core.nativeMapVerified` | | `keyOf` | "What is this pool's registry key?" | `Core.pairKey`, the one producer | | `KINDS_ROUTABLE` / `KINDS_EXECUTABLE` / `KINDS_PAIR_PROOF` | "Which kinds may enter / execute / must prove their pair?" | `Hub` | | `hookAltersDeltas` bit map | "Does this hook return deltas?" | `Core` | | `MAX_BRIDGES` ↔ Solver arms | "How many bridges does the planner actually walk?" | `Hub` ×7, `Solver` ×2 | | `MAX_LEGS_PER_HOP` (5; finding PIN-01) | "How many legs fit in one hop?" | `Core:145`, the one producer since 2026-11-06: the Router refuses a wider hop with `RouterE(3)` | | `MAX_HOPS` (2) | "How many hops fit in one route?" | `Core:132`, the one producer since 2026-11-06 | | `singleOutFloor` (the floor the Solver attests, in the frame the Router compares it in) | "Against which input was this floor sized, and against which is it compared?" | `Solver._assembleRouteMulti`, one producer for every route since 2026-11-11 | | `feeHop` (the hop the protocol fee anchors on) | "On which hop is the fee taken, and in which bridge?" | `Core.feeCalendar`, the one producer since 2026-10-27 | | Layer 2 scope (hookless before hooked) | "Over what span may no hookless leg follow a hooked one?" | `Router._execute` | | `Volume` | "How much really went through this pool?" (`amtIn`, `amtOut`) | emitted by `Hub.recordSwap` from the amounts the Router passes | | `legTook` / `legOut` (what one leg's venue took in and delivered, per leg of the route) | "How much did THIS venue actually receive, and how much did it actually pay?" | produced once per leg by `Router._execScaled`: `legOut` is the Router's own tokenOut balance delta over the leg, bounded by the venue's declared payment (DEX-11). | | `v4EntryOf` (V4 row → V4Entry) | "Where is this V4 row's tickSpacing?" | written by every V4 door | | V4 row identity at the seed door (the row's pool vs the id its V4Entry derives) | "Which pool does this V4 row measure?" | `Hub.seedPool` recovers the tier on the hookless id | | `factoryDeployer` (the attested Algebra origin) | "Which CREATE2 origin do this factory's mode-5 fee-0 probes derive from?" | written by `Hub.addFactory` from `Core.resolvePoolDeployer` at admission | | `factories[]` row ↔ `factoryCodehash` / `factoryDeployer` (keyed by address) | "Is this factory already admitted, and which row is it?" | the array holds the rows, the mappings are keyed by address | | `factories[row].initHash` (the CREATE2 derivation input of a live row) | "Which address does discovery derive for this factory?" | written by `Hub.addFactory` on both arms | | `finalHopQuote` (the figure the output floor is a fraction of) | "What should this hop have delivered?" | produced in `Router._execute` from `hopQuote`: the sum over the hop's legs of each leg's in-frame quote, or its attested figure when the frame could not price it (a Gate leg, a native leg with no in-frame quote; since 2026-10-23, so a hop with no in-frame quote at all reads `hopBound` as before). | | `SELF` (the account the Router code executes as) | "Whose balances does this swap measure and move?" | two producers of one answer: `address(this)`, which under an EIP-7702 delegation is the delegating EOA, and the deployment address, fixed in the code as the immutable `SELF`. | | `v3Salt` (the V3 salt of (t0, t1, fee)) | "Under which salt does a V3-salt factory deploy the pool of (t0, t1, fee)?" | `Core.v3Salt` | | `liveAdapter` (Gate: which adapter may run for a family) | "Which adapter may trade for family f, right now?" | `Gate.liveAdapter` is the one producer | | `venuePool` (Gate wrapper) | "Which venue pool does this wrapper trade on?" | written once, at `Gate.create`, from the family adapter's `resolve` | | `KIND_EXTERNAL` fail-closed (kind 9 where the Core has no reader) | "What does the Core read for a kind with no reader?" | two Core sites: `Core.provenShape` (refuses), `Core.registryDepth18` (0). | | `KINDS_V3_SALT` | "Which kinds may sit in the V3 salt slot (mode 5)?" | `Hub.addFactory` only | | kind-9 doors (where a Gate leg may execute) | "Through which doors may a kind-9 leg execute?" | every door: the Router's execution dispatch serves kind 9 at the three explicit doors and at the best door's self-call `selfExecutePrePulled`, always behind `Core.gateWrapperLive` (row `kind-9 identity`). | | kind-9 identity (is this pool a Gate wrapper?) | "Is the pool of a kind-9 leg the admitted Gate's wrapper for this hop and fee?" | `gateWrapperLive` in the Core, the one producer | | Gate quote (price of a kind-9 leg) | "What is a Gate leg worth?" | `Core.gateQuote`, the one producer since 2026-10-22: identity first | | `_requireWrapper` (Gate adapters, adapters-1021) | "May this caller make the adapter move tokens, and which tokens?" | `ExtAdapterBase._requireWrapper` asks the Gate's own registry | | `_quote` (Curve NG) | "What does this NG leg pay for amtIn?" | one private body read by `quote` | | `_quote` (Curve crypto NG) | "What does this Twocrypto-NG / Tricrypto-NG leg pay for amtIn?" | one private body read by `quote` | | `_out` (Liquidity Book) | "What does this Liquidity Book leg pay for amtIn?" | one private body read by `quote` | | `_out` (Algebra Integral) | "What does this Algebra Integral leg pay for amtIn?" | one private body read by `quote` | | `_requireHookPinned` (Gate adapters) | "May this pool's hooks run under the adapter?" | `ExtAdapterBase._requireHookPinned`, the one producer since 2026-11-14 | | `_hooksOk` (Liquidity Book) | "May this pair's hooks run under the adapter?" | one function over the pair's `getLBHooksParameters`: read at `resolve` | | `_pluginOk` (Algebra Integral) | "May this venue's plugin run under the adapter?" | one function over the plugin config of the venue's state read: BEFORE_SWAP and DYNAMIC_FEE are refused always. | | `_requireHookPinned` (Infinity CL, Infinity Bin) | "May this pool's hooks run under the adapter?" | `ExtAdapterBase._requireHookPinned` | | adapter `depth18` | "How deep is this external leg?" | `ExtAdapterBase._depth18`, the one adapter producer: the shorter side of the balances the venue itself reports, each normalised by its token's decimals, through `Core.shortSide18`, the registry's own depth of a pair (`registryDepth18`'s reserves arm, `depthFromL18`), so one mass reads one depth on both doors. | | adapter `depth18` (Liquidity Book form) | "How deep is this Liquidity Book leg?" | `ExtAdapterBase._depth18`, the row above, fed by a fifth form, by reserves: the pair's `getReserves`, what it reports its LPs own | | adapter `depth18` (Algebra Integral form) | "How deep is this Algebra Integral leg?" | `ExtAdapterBase._depth18`, the row two above, fed by the reserves form: the venue's `getReserves`, what it books, never its balanceOf, so a donation adds no depth. | | Gate use (`vitalSlot`, a wrapper's swap count) | "How used is this Gate wrapper?" | `Wrapper.swap`, the one writer, after the custody checks: Core's `tickSlot` then `stampTs`, in the Hub's slot layout, only when the swap is material on both sides of the venue pool (input >= the venue's balance of the input token >> `MATERIAL_SHIFT`, output >= its balance of the output token >> `MATERIAL_SHIFT`, output non-zero; each side in its own token). | | Gate fitness (`vitalOf`: vitality, depth18, psi of a wrapper) | "How fit is this Gate wrapper for the registry?" | `Gate.vitalOf`, the one producer, relayed by `Quoter.gateVitalOf` behind `Core.gateWrapperLive`: zeros unless the Gate created the wrapper and its family is live. | | kind-9 registry feedback (does a Gate leg reach `Hub.recordSwap`) | "Who records that a kind-9 leg was used?" | `Wrapper.swap` alone | | `wrappersOf` (the Gate's per-pair list; `MAX_WRAPPERS_PER_PAIR` = Core's `GATE_MAX_WRAPPERS` = 4) | "Which wrappers may the automatic door seat for this pair?" | `Gate.create` is the one writer | | `gatePsi` (a wrapper's score in the Solver's funnel) | "How does the funnel order a kind-9 row?" | `Gate.vitalOf`'s psi, read by `Core.gatePsi` in the Solver's ordering loop in place of the Hub's psi, which is 0 for a pool with no Hub row | | pool clock (`tau`, bits [255:224] of a registry row; the Gate's `vitalSlot` alike) | "How often does this pool trade, on its own clock?" | Core's `tickSlot`, the one writer of a row's clock: the count, tau and `lastUpdateTs` | | learned V4 code (`v4CodeOf`, a token's V4 launch-tier hint) | "At which hookless V4 tier does this token trade?" | `Hub._writeV4Code`, the one body, reached from four doors: `claimV4` after `_register` admitted the row | | `scratch` (where an assembly call or copy writes its answer: 0x00-0x3f) | "Where may a raw call put the words it reads?" | Solidity's scratch 0x00-0x3f, or memory the caller allocated | | `MODES_READ_FEE` / `MODES_READ_SPACING` (which grid axes a factory mode reads) | "Do two cells of a row's grid ask its factory different questions?" | `Core.deriveAddress` / `_factoryLookup` | **Transient state.** | Quantity | The question it answers | Producer | |---|---|---| | `TSLOT_FOT` | "What net ratio (WAD, compounded) did this swap's taxed transfers keep, for the route floor? 0 = none seen" | `Router._noteFot` | | `received` (what a door's pull delivered) | "How much `tokenIn` did this call's pull actually put on the Router?" | `Router._received`, one producer since 2026-10-28 | | transient slot numbering | "Which slot holds what?" | `Router` | | `realIn` (hop h ≥ 1: `_owned(bal − kept, bridgeBase[h−1], hopGot − fee)`) | "How much of the bridge may this hop spend?" | `Router._hopScaleImpactAndQuote` | **Measurement harness (tools/g7-gas-campaign).** | Quantity | The question it answers | Producer | |---|---|---| | `active_b0` (liquidity in range at the window start b0; G7 campaign, 2026-11-14) | "Can this concentrated pool fill a swap at b0?" (not "how much is in the pool?") | `build_spec.active_at` is the one producer: `liquidity()` of a V3-shaped pool | ## Appendix E · The venues This appendix lists, in one place, every venue family the DEX supports as its README states it at `6387350`, and for each one how a pool is found, how it is priced and whether the price is a closed form the Core computes or an answer it delegates. The mode numbers are those of the resolution table in §7.1 and the kind numbers those of §4.1. A quote is advice to the caller in every row; the Router's execution floors read what arrived, never the quote (§4.4). | Venue | Kind | How a pool is found | How the price is measured | Closed form or delegated | |---|---|---|---|---| | Uniswap V2 and constant-product forks | 0 | factory call (mode 0), or CREATE2 arithmetic where the deployment is reproducible (mode 4); the pair proves its `token0`/`token1` | `getReserves`, after the pair is shown to hold what it declares (`heldBy`) | closed form `outV2` (§4.2) | | Uniswap V3 and V3-shaped forks | 1 | factory call (mode 1), or CREATE2 arithmetic (mode 5); the pool proves its pair | `slot0` and the active liquidity for the ranking; the pool's own ticks walked for the promise (`v3PaysOnBudget`) | closed form for the ranking; the venue's own book for the promise | | Uniswap V4 | 4 | pool ids derived from public parameters and each proven live against the PoolManager's storage (mode 9); no address, no call | the tick book walked through `extsload`, 16 steps for the promise, up to 256 for the ranking | walked in the frame, no venue answer trusted (§5) | | Uniswap V4, native ETH | 8 | as V4; never registered by a factory row | as V4 | as V4 | | Algebra (dynamic fee) | 6 | CREATE2 arithmetic with the Algebra sentinel (mode 5, `fee == 0`, origin the factory's `poolDeployer()`), or a factory call (mode 1) | as kind 1, the live fee measured from `globalState` | closed form, fee measured | | Solidly (stable and volatile) | 5 | factory call (mode 2) or CREATE2 arithmetic (mode 6); the pair proves its tokens | the pool's `getAmountOut` less one wei; the replicated curve is the fallback when the pool does not answer | ask-the-venue first; the replicated stable-curve solver as fallback (§4.2) | | Balancer V2 | 9 | a Gate wrapper at the address the Gate's creation code derives (the Hub's `MODE_CREATE2_V3` row); created by the curator | `gateQuote`: identity, then the wrapper's own `quote`, through the family's adapter | delegated to the adapter (`AdapterBalancerV2`) | | Balancer V3 | 9 | as Balancer V2 | as Balancer V2 | delegated (`AdapterBalancerV3`) | | Curve StableSwap-NG | 9 | as Balancer V2 | as Balancer V2 | delegated (`AdapterCurveNG`) | | Curve Twocrypto-NG and Tricrypto-NG | 9 | as Balancer V2 | as Balancer V2 | delegated (`AdapterCurveCryptoNG`) | Two rules apply to every row of kind 9. The Router measures each leg's balance delta and refuses one above what the wrapper declared it paid (RouterE(20)); the per-leg floor and the hop budget read that measured delta, the caller's minimum reads what reaches the recipient, and the route floors read the gross the venues declared (`outCap`) (§4.5). An adapter enters only after the `ADAPTER_DELAY` of 48 hours, with its code hash pinned, and a changed adapter stops every wrapper of its family at the next call. Three further families stand behind the Gate on the same terms as Balancer V2 (kind 9, delegated to the family's adapter): Liquidity Book, LFJ v2.1 and v2.2 and Pharaoh DLMM (`AdapterLB`); Algebra Integral custom venues (`AdapterAlgebraIntegral`); PancakeSwap Infinity CL and Bin (`AdapterInfinityCL`, `AdapterInfinityBin`). ## Glossary **The operators.** | Symbol | Name | One line | |---|---|---| | Ω | Eightfold Dispatcher | prices every leg — closed form where a closed form is exact, ask-the-venue where the venue's own bytecode is the only honest source; "Eightfold" by history, seven kinds in five families today (the seventh kind, external venues behind the Gate, is delegated, §4.5) | | 𝒟 | Deterministic Derivation | computes pool addresses by CREATE2 arithmetic where deployment is reproducible, asks and then proves the pair where it is not, derives and proves pool ids for the V4 singleton; `hasCode` discards what has no bytecode | | Φ | Iron-Law floor | the protocol's own retention floor: 96 % base, loosening with measured impact and measured concentration, hard-clamped at 80 % (8,000 bps), applied to the final hop's in-frame quote | | Ψ | Vitality Field | venue quality computed from the Monoslot alone; ranks the candidate set and settles exact ties — it can order a venue, never misprice one | | Ξ | anti-scam projector | removes any route touching a delta-altering or inadmissible hook from the maximisation, before ranking, without calling the hook | **The terms.** **Adapter** — the per-family contract behind a Gate wrapper that speaks to the external venue; a new or replaced adapter takes effect only after the 48-hour `ADAPTER_DELAY` (§4.5). **Anchored regime** — the fee charged once, on the first bridge coin the Router holds (or on the output of a direct route into a bridge coin). **Believability band** — the no-arbitrage band around the depth-weighted median of the candidates' prices; a candidate outside it is not believed (§10.3). **Coverage gate** — a leg's attested bound raised to at least half the measured in-frame quote (`max(attested, quote × 5,000 / 10,000)`), never lowered. **Deployment (staking)** — one instance of the staking contract with its own reward reserve, protocol reserve and emission clock; the engine is deployed twice, and the two do not see each other (§25.8). **Exact Pass** — the Quoter's pool-exact preview: the venue's own swap run and rolled back by revert-extraction. **Exhaustion regime** — no bridge coin as any hop's input: every hop pays 28 bps on its own measured input; immune to a value-less prefix by construction. **Fee ledger** — a transient count of fee payments per settlement, refusing zero and refusing two on an anchored route. **Gate** — the contract that puts every external venue behind an immutable per-venue wrapper; a pair has at most four wrappers (§4.5). **Hermes plugin** — a plugin for the Hermes agent runtime that gives an agent four BlazePhoenix tools; it reads the user's node from the agent's secret store and asks the hosted API to prepare and decode a quote, checking both against the node's answer (§27.5). **Hop** — one token-to-token step of a route; a route has at most 2 hops. **Leg** — one pool's share of a hop; a hop has at most 5 legs, so a route has at most 10. **MCP server** — a tool server for AI agents speaking the Model Context Protocol; the local one runs on the user's machine over the SDK and the user's node, the hosted one prepares and decodes calls that the caller's node runs (§27.3, §27.4). **Metrological Design** — build the contract as an instrument: collapse diversity into coordinates, measure every coordinate that can be measured, make the rest monotone. **Meta-Equation** — the whole aggregator as one maximisation, a product so that a single failing factor zeroes the route. **Monoslot** — a pool's entire routing state in one 256-bit word, no price inside. **One-Callback Doctrine** — one `fallback` answers every V3-shaped venue's flash-accounting callback, guarded three ways. **One-Way Door** — renunciation as bytecode: `renounceControl` writes a flag no code path can unset; the control tier ends, the grow-only curator tier remains. **Pair-proof** — a pool proves its `token0`/`token1` (or its re-derived id) before the registry stores it or discovery lists it. **Projection distance** — how far a refusal's observed object sits from the object that decides. **Self-Healing Registry** — the protocol learns liquidity by trading it: sixteen slots per pair, fitness-ranked eviction, decay by arithmetic. **Surplus Rule** — the protocol's take is 28 bps of one measured base and nothing that scales with the gap between quote and delivery. **Third way** — any outcome of a fixture that is neither a settlement inside the floors with nothing left on the Router nor a refusal with a selector of ours. **Wrapper** — the immutable per-venue contract of the Gate: a V3-shaped `swap` and `uniswapV3SwapCallback` in front of a curated adapter whose code hash is pinned. **X-Ray** — the SDK's second entry point, which measures by simulation on a pinned block whether a token can be bought, sold and transferred at the tax the caller accepts; NOT_MEASURED is a status, not a pass (§27.2). ## References 1. G. Angeris, A. Evans, T. Chitra, S. Boyd. *Optimal Routing for Constant Function Market Makers.* arXiv:2204.05238, 2022 (ACM EC '22). — Routing over CFMMs as a convex program; the optimum the proportional allocator of §10.4 sits short of. 2. T. Diamandis, M. Resnick, T. Chitra, G. Angeris. *An Efficient Algorithm for Optimal Routing Through Constant Function Market Makers.* arXiv:2302.04938, 2023 (Financial Cryptography 2023). — The dual-decomposition algorithm for the same problem (§23). 3. H. Adams, N. Zinsmeister, D. Robinson. *Uniswap v2 Core.* 2020. https://uniswap.org/whitepaper.pdf — The constant-product reference and the 30 bps default of §4.2. 4. H. Adams, N. Zinsmeister, M. Salem, R. Keefer, D. Robinson. *Uniswap v3 Core.* 2021. https://uniswap.org/whitepaper-v3.pdf — Concentrated liquidity, `slot0`, Q64.96 fixed point (§4.2, §15.6). 5. Uniswap Labs (H. Adams et al.). *Uniswap v4 Core.* 2024. https://uniswap.org/whitepaper-v4.pdf — The singleton PoolManager, flash accounting and the hook-permission address encoding (§5, §14.2). 6. M. Egorov. *StableSwap — Efficient Mechanism for Stablecoin Liquidity.* 2019. https://curve.fi/files/stableswap-paper.pdf — The amplified invariant of the Curve family, which the DEX reaches through the Gate and does not replicate (§4.5). 7. P. Daian, S. Goldfeder, T. Kell, Y. Li, X. Zhao, I. Bentov, L. Breidenbach, A. Juels. *Flash Boys 2.0: Frontrunning in Decentralized Exchanges, Miner Extractable Value, and Consensus Instability.* IEEE S&P 2020. DOI 10.1109/SP40000.2020.00040. — The ordering adversary §14.3 bounds rather than claims to eliminate. 8. L. Zhou, K. Qin, C. F. Torres, D. V. Le, A. Gervais. *High-Frequency Trading on Decentralized On-Chain Exchanges.* IEEE S&P 2021. DOI 10.1109/SP40001.2021.00027. — Sandwich attacks measured and formalised (§14.3). 9. P. Cousot, R. Cousot. *Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints.* POPL 1977. DOI 10.1145/512950.512973. — The frame for the single-tick closed form as a sound abstraction (§23). 10. M. R. Clarkson, F. B. Schneider. *Hyperproperties.* Journal of Computer Security 18(6), 2010. DOI 10.3233/JCS-2009-0393. — Properties of sets of traces; the class the redistribution findings belong to (§21, §23). 11. T. Y. Chen, S. C. Cheung, S. M. Yiu. *Metamorphic Testing: A New Approach for Generating Next Test Cases.* HKUST-CS98-01, 1998; arXiv:2002.12543. — The second judge of §15.7. 12. R. A. DeMillo, R. J. Lipton, F. G. Sayward. *Hints on Test Data Selection: Help for the Practicing Programmer.* IEEE Computer 11(4), 1978. DOI 10.1109/C-M.1978.218136. — Mutation analysis and the coupling hypothesis (§15.2). 13. A. Avizienis. *The N-Version Approach to Fault-Tolerant Software.* IEEE TSE SE-11(12), 1985. DOI 10.1109/TSE.1985.231893. — The ancestor of §15.8. 14. D. R. Kuhn, R. N. Kacker, Y. Lei. *Practical Combinatorial Testing.* NIST SP 800-142, 2010. DOI 10.6028/NIST.SP.800-142. — Covering arrays and t-way interaction coverage (§15.4). 15. B. Littlewood, L. Strigini. *Validation of Ultrahigh Dependability for Software-Based Systems.* Communications of the ACM 36(11), 1993. DOI 10.1145/163359.163373. — Why no probability of correctness is stated (§15.11). 16. A. Akhunov, M. Salem. *EIP-1153: Transient Storage Opcodes.* https://eips.ethereum.org/EIPS/eip-1153 — The leg context, the fee ledger and the reentrancy lock (§11.4, §13.2). 17. V. Buterin. *EIP-170: Contract Code Size Limit.* https://eips.ethereum.org/EIPS/eip-170 — The 24,576-byte wall (§16.3). 18. V. Buterin. *EIP-1014: Skinny CREATE2.* https://eips.ethereum.org/EIPS/eip-1014 — The address arithmetic of 𝒟 (§7). 19. M. Lundfall et al. *EIP-2612: Permit Extension for EIP-20 Signed Approvals.* https://eips.ethereum.org/EIPS/eip-2612 · Uniswap Labs. *Permit2.* https://github.com/Uniswap/permit2 — The Permit2 door (§11.1). 20. V. Buterin, S. Wilson, A. Dietrichs, M. Garnett. *EIP-7702: Set Code for EOAs.* https://eips.ethereum.org/EIPS/eip-7702 — Delegated accounts call the same doors (§11.1). 21. *ERC-7201: Namespaced Storage Layout.* https://eips.ethereum.org/EIPS/eip-7201 — The Hub's storage namespace (§16.1). 22. MariaDB Corporation Ab. *Business Source License 1.1.* https://mariadb.com/bsl11/ — The code licence. 23. Mitra. *BlazePhoenix-Dex: an on-chain DEX aggregator with measured routing.* Repository, `main` 969bcc6, 2026-11-16. https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Dex — The canonical source for every claim about the DEX in this paper; Appendix C reproduces the numbers from it. 24. S. Müller, N. Moumeni, A. Messaoudi. *Cost of Manipulation in AMM-Based Oracles.* arXiv:2606.03548, 2026 (Financial Cryptography 2026, DeFi workshop). — The liquidity-weighted median bound behind E25 (§10.3, §23). 25. *Ormer: A Manipulation-resistant and Gas-efficient Blockchain Pricing Oracle for DeFi.* arXiv:2410.07893. — A median-estimating on-chain oracle (§23). 26. *From Means to Medians: Optimal Benchmark Design.* arXiv:2506.22142. — Which benchmarks are hardest to manipulate (§23). 27. *Optimal Routing across Constant Function Market Makers with Gas Fees.* arXiv:2603.02844. — Routing with gas (§23). 28. *Routing Frictions and Executable Liquidity in Fragmented Markets.* arXiv:2609.19013. — Advertised versus executable liquidity (§23). 29. Mitra. *Blaze-Phoenix-Staking: the BZPX staking engine, Staking V4.* Repository, `main` 9958d5f, 2026-11-24. https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Staking — The canonical source for every claim about the staking engine in §25; the second block of Appendix C reproduces its numbers from it. 30. Mitra. *BlazePhoenix SDK* (`@blazephoenix/sdk`). Repository, `main` 2d2fc39 (1.7.0), 2026-11-21; npm 1.6.0 from `bb41243`. MIT licence. https://github.com/blazephoenixxyz-crypto/SDK — The client, the Phoenix Check, the calldata verification and the X-Ray of §27.2. 31. Mitra. *BlazePhoenix MCP server* (`@blazephoenix/mcp`). Repository, `main` 3514804 (1.3.0), 2026-11-20. MIT licence. https://github.com/blazephoenixxyz-crypto/blazephoenix-mcp — The local MCP server of §27.3. 32. Mitra. *Blaze-Phoenix-API.* Repository, `main` 01c5468, 2026-11-20. MIT licence. https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-API — The hosted MCP endpoint and the REST API of §27.4. 33. Mitra. *BlazePhoenix Hermes plugin.* Repository, `main` cf38638 (1.0.0), 2026-11-21. MIT licence. https://github.com/blazephoenixxyz-crypto/blazephoenix-hermes-plugin — The Hermes plugin of §27.5. ## How to cite Mitra. *BlazePhoenix Technical Whitepaper: an on-chain liquidity aggregator whose quote and execution are one computation.* Version 2.4.0, 2026-11. Zenodo. DOI: to be assigned by Zenodo on deposit. BibTeX and other formats: https://blazephoenix.xyz/research/whitepaper Earlier versions, each with its own record: version 2.3.1, 2026-11-16, DOI [10.5281/zenodo.24372939](https://doi.org/10.5281/zenodo.24372939); version 2.3.0, 2026-09-24, DOI [10.5281/zenodo.23084091](https://doi.org/10.5281/zenodo.23084091); concept DOI of that record, [10.5281/zenodo.23084090](https://doi.org/10.5281/zenodo.23084090); concept DOI of the first deposit series (version 2.2), [10.5281/zenodo.22526574](https://doi.org/10.5281/zenodo.22526574). A citation of the numbers in this paper cites 2.4.0 and, with it, the commits named in Appendix C: `969bcc6` for the DEX and `9958d5f` for the staking engine.