Skip to main content

RerouteParams

Struct RerouteParams 

Source
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: RerouteAggregators

Whose 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: RerouteScopes

Where 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: bool

Also 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: bool

Also 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: bool

Reroute 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: bool

Price 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§

Source§

impl RerouteParams

Source

pub const fn is_noop(&self) -> bool

Whether this block asks for anything at all — a session with neither re-quoting nor a venue template has a reroute section that does nothing.

Trait Implementations§

Source§

impl Clone for RerouteParams

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RerouteParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RerouteParams

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for RerouteParams

Source§

impl PartialEq for RerouteParams

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RerouteParams

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RerouteParams

Auto Trait Implementations§

§

impl Forget for RerouteParams

§

impl Freeze for RerouteParams
where *const LeafNode<SwapAggregator, SetValZST> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(SwapAggregator, SetValZST)>>: Freeze, *const LeafNode<SwapScope, SetValZST> is !null: Freeze, PhantomData<Box<(SwapScope, SetValZST)>>: Freeze, *const LeafNode<MintPair, SetValZST> is !null: Freeze, PhantomData<Box<(MintPair, SetValZST)>>: Freeze, *const u8 is !null: Freeze, PhantomData<VenueTemplate>: Freeze, *const LeafNode<Address, SetValZST> is !null: Freeze, PhantomData<Box<(Address, SetValZST)>>: Freeze,

§

impl Move for RerouteParams

§

impl RefUnwindSafe for RerouteParams

§

impl Send for RerouteParams
where NodeRef<Owned, SwapAggregator, SetValZST, LeafOrInternal>: Send, BoxRaw<(SwapAggregator, SetValZST)>: Send, NodeRef<Owned, SwapScope, SetValZST, LeafOrInternal>: Send, BoxRaw<(SwapScope, SetValZST)>: Send, NodeRef<Owned, MintPair, SetValZST, LeafOrInternal>: Send, BoxRaw<(MintPair, SetValZST)>: Send, RawVecInner: Send, NodeRef<Owned, Address, SetValZST, LeafOrInternal>: Send, BoxRaw<(Address, SetValZST)>: Send,

§

impl Sync for RerouteParams
where NodeRef<Owned, SwapAggregator, SetValZST, LeafOrInternal>: Sync, BoxRaw<(SwapAggregator, SetValZST)>: Sync, NodeRef<Owned, SwapScope, SetValZST, LeafOrInternal>: Sync, BoxRaw<(SwapScope, SetValZST)>: Sync, NodeRef<Owned, MintPair, SetValZST, LeafOrInternal>: Sync, BoxRaw<(MintPair, SetValZST)>: Sync, RawVecInner: Sync, NodeRef<Owned, Address, SetValZST, LeafOrInternal>: Sync, BoxRaw<(Address, SetValZST)>: Sync,

§

impl Unpin for RerouteParams
where *const LeafNode<SwapAggregator, SetValZST> is !null: Unpin, Box<(SwapAggregator, SetValZST)>: Unpin, *const LeafNode<SwapScope, SetValZST> is !null: Unpin, Box<(SwapScope, SetValZST)>: Unpin, *const LeafNode<MintPair, SetValZST> is !null: Unpin, Box<(MintPair, SetValZST)>: Unpin, *const u8 is !null: Unpin, *const LeafNode<Address, SetValZST> is !null: Unpin, Box<(Address, SetValZST)>: Unpin,

§

impl UnsafeUnpin for RerouteParams
where *const LeafNode<SwapAggregator, SetValZST> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(SwapAggregator, SetValZST)>>: UnsafeUnpin, *const LeafNode<SwapScope, SetValZST> is !null: UnsafeUnpin, PhantomData<Box<(SwapScope, SetValZST)>>: UnsafeUnpin, *const LeafNode<MintPair, SetValZST> is !null: UnsafeUnpin, PhantomData<Box<(MintPair, SetValZST)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<VenueTemplate>: UnsafeUnpin, *const LeafNode<Address, SetValZST> is !null: UnsafeUnpin, PhantomData<Box<(Address, SetValZST)>>: UnsafeUnpin,

§

impl UnwindSafe for RerouteParams
where BTreeMap<SwapAggregator, SetValZST>: UnwindSafe, BTreeMap<SwapScope, SetValZST>: UnwindSafe, BTreeMap<MintPair, SetValZST>: UnwindSafe, RawVecInner: UnwindSafe, BTreeMap<Address, SetValZST>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V