pub struct L1Score {
pub l1_fill: Option<u64>,
pub change_vs_l1_bps: Option<i64>,
}Expand description
What the original swap filled, and how the stand-in scored against it. Flattened into the
notification’s top level. l1 in a name means the original (onchain) swap.
The scope differs by kind: a venue probe scores one HOP’s onchain output, a replayed original the net route flow across the whole SWAP’s pair, a reroute what the original realized across the transaction. Compare within a kind; never sum or average across kinds.
Fields§
§l1_fill: Option<u64>What the original swap filled, in raw base units (wire l1Fill). None when it filled
zero, which is no baseline.
change_vs_l1_bps: Option<i64>The stand-in against Self::l1_fill in bps, clamped to ±CHANGE_CLAMP_BPS
(wire changeVsL1Bps). Positive means it beat the original swap. Absent when either side
is missing or zero.
Implementations§
Source§impl L1Score
impl L1Score
Sourcepub fn new(measured: Option<u64>, l1_fill: u64, mode: SwapMode) -> Self
pub fn new(measured: Option<u64>, l1_fill: u64, mode: SwapMode) -> Self
Score measured against what the original swap moved on the same side. ExactIn measures
output, so more is better; ExactOut measures the input charged, so the sign is flipped and
positive always means the stand-in beat what traded. A historical fill of zero is no
baseline: dividing by it would clamp to a number rather than say nothing.
A measured zero is left unscored for the same reason. Some venues decline by returning
zero rather than by reverting, which is a refusal to quote and not a quote of nothing;
scored, it lands at CHANGE_CLAMP_BPS and a handful of declines sink a venue’s mean far
below what it actually paid.