pub struct RerouteParams {
pub aggregators: RerouteAggregators,
pub scopes: RerouteScopes,
pub filter: Option<RerouteFilter>,
pub detect_failed_l1_swaps: bool,
pub circular_arbs: bool,
pub requote: bool,
pub venue_templates: Vec<VenueTemplate>,
pub extra_markets: BTreeSet<Address>,
pub quote_late_in_slot: bool,
}Expand description
Rerouting historical swaps through the router: each admitted swap is rerouted and the routed transaction is simulated just before the original executes — never committed, so the replay is unaffected. Each simulation reads the state of the batch its original belonged to; reroutes never observe one another.
Presence is the switch, which makes “a knob but no rerouting” unrepresentable rather than a validation error.
Silent defaults: an empty object ("reroute": {}) reroutes Jupiter’s swaps only, every pair,
through the router (requote: true), with no venue templates, no failed original swaps and no
atomic arbitrage.
Fields§
§aggregators: RerouteAggregatorsWhose original swaps to reroute. Default: Jupiter’s alone. This also limits rerouting directly to a venue: only swaps from these aggregators reach the templates.
scopes: RerouteScopesWhere an admitted swap may have run to be rerouted. Self::aggregators names the
router either way, so admitting Jupiter admits a Jupiter route a bot CPI’d once
SwapScope::Nested is on.
filter: Option<RerouteFilter>Restrict rerouting to the mint pairs of interest — a maker’s own book. Absent: every detected swap on an admitted aggregator is rerouted.
detect_failed_l1_swaps: boolAlso reroute swaps whose historical transaction failed, when the allowlist admits the failure as one rerouting can answer (a slippage rejection, or a failure after the swap already ran).
Off by default. The original swap realised nothing for these, so nothing compares with
it, and they are counted apart: swaps_detected and swaps_rerouted exclude them, and
every row carries original_failed. l1 in the name means the original (onchain) swap.
circular_arbs: boolAlso reroute atomic arbitrage — swaps whose input and output mint are the same. Each cycle
is quoted leg by leg and built back as one circular route. A cycle that can’t be split into
legs fails with a cycle_* category. Off by default: a transaction holding a cycle is then
left out as filtered.
requote: boolReroute detected swaps through the router.
On by default. Turn it off to reroute only directly to a venue, with
Self::venue_templates: the session then runs without the router, which a venue the
router cannot route does not need.
venue_templates: Vec<VenueTemplate>Instruction templates to probe against the hops this session detects, alongside the re-quoting: each hop whose direction and mode a template names is instantiated through it, funded, simulated and scored against what the historical hop filled. Empty: no rerouting directly to a venue.
The templates decide only how a hop is priced. Self::aggregators still decides which
original swaps reach them, so a session that only reroutes directly to a venue must list
every router whose hops it wants priced.
directFill on the wire.
extra_markets: BTreeSet<Address>Pools for the router to consider on top of the markets it already knows. Each must hold
an account at the start of the range: a pool that exists nowhere onchain gets its
accounts from an account override anchored at the first slot. Requires Self::requote.
quote_late_in_slot: boolPrice each swap as late in its quote slot as it could have been, instead of at the slot’s start: after the slot’s last transaction, or just before the swap’s own batch when it lands in that slot.
Implementations§
Trait Implementations§
Source§impl Clone for RerouteParams
impl Clone for RerouteParams
Source§impl Debug for RerouteParams
impl Debug for RerouteParams
Source§impl Default for RerouteParams
Hand-written rather than derived: requote defaults to ON, and a derived Default would
give the opposite of what deserializing an empty object gives.
impl Default for RerouteParams
Hand-written rather than derived: requote defaults to ON, and a derived Default would
give the opposite of what deserializing an empty object gives.