Expand description
The parts of a replacementSubscribe payload that every kind carries.
Three mechanisms stand in for a historical swap — metis re-routing a whole transaction, a probe re-pricing one hop, the original replayed as its own baseline — and they carry different shapes. What they share is declared once here and flattened into each shape on both sides of the wire, so a field the server emits cannot be silently dropped by a client that forgot to restate it.
Structs§
- Change
Bps - A recorded change, and whether
CHANGE_CLAMP_BPSis what bounded it. - Direct
Fill Notification - One direct-fill probe’s result - the
DirectFillshape ofReplacementNotification: a single hop re-priced through a direct-fill template, simulated against the state it would have traded on. - L1Score
- What the original filled on L1, and how the shape carrying this scored against it.
- Original
Notification - One replayed original - the
Originalshape ofReplacementNotification: the historical transaction itself, re-run against the state it was quoted at, so the other two kinds are scored against a number produced the same way rather than against the chain’s. - Replacement
Context - The slot the payload was produced at, in the shape every other subscription’s context takes.
- Replacement
Core - The identity and ending every replacement payload carries, whatever kind it is.
- Requote
Notification - One rerouted transaction’s simulation result - the
Requoteshape ofReplacementNotification. The historical original still executed; this is the counterfactual, committed nowhere. - Reroute
LegNotification - One re-quoted swap within a rerouted transaction’s simulation.
- Signature
- A 64-byte Ed25519 signature.
- SimCost
- What running one stand-in cost, for the kinds that simulate a whole transaction.
Enums§
- Replacement
Notification - What stood in for a historical swap, streamed over
replacementSubscribe. Internally tagged onkind: three mechanisms answer different questions - metis re-routing a whole transaction, a probe re-pricing one hop, and the original replayed as its own baseline - so they carry different shapes rather than one union.
Constants§
- BPS_
SCALE - Basis points per whole unit.
- CHANGE_
CLAMP_ BPS - Clamp bound for a single swap’s recorded change, ±1,000% of the base. Losses bound themselves at −100%, so only gains ever reach this; wide enough that no economically real improvement truncates (the old ±100% cap flattened every gain past 2×), tight enough that one dust-base ratio moves a 10k-leg aggregate mean by at most ~10 bps.
Functions§
- clamped_
change_ bps - Change from
basetonewin bps, clamped to ±CHANGE_CLAMP_BPS. Callers guardbase > 0.