pub enum RouterType {
LimitOrder,
V2,
V3,
}Expand description
Represents the different types of Odos routers.
Different chains support different combinations of these router types.
Use the OdosChain trait methods to check router availability per chain.
§Event Schemas
Important: Router types emit fundamentally different events:
| Router Type | Events Emitted |
|---|---|
V2 | Swap, SwapMulti |
V3 | Swap, SwapMulti (with referral/slippage fields) |
LimitOrder | LimitOrderFilled, LimitOrderCancelled, etc. |
When iterating over router types for event processing, use swap_routers()
to get only routers that emit Swap/SwapMulti events, or order_routers()
for limit order routers.
§Example
use odos_sdk::RouterType;
// When processing swap events, iterate only over swap routers
for router_type in RouterType::swap_routers() {
// V2 and V3 both emit Swap/SwapMulti events
assert!(router_type.emits_swap_events());
}
// LimitOrder routers require separate event handling
for router_type in RouterType::order_routers() {
assert!(!router_type.emits_swap_events());
}Variants§
LimitOrder
Limit Order V2 router for limit order functionality.
Available on all supported chains.
Note: This router emits LimitOrderFilled, LimitOrderCancelled, and other
limit order-specific events. It does not emit Swap or SwapMulti events
like V2/V3 routers. Use emits_swap_events() to
check event compatibility, or swap_routers() to
iterate only over routers that emit swap events.
V2
V2 router for swap functionality.
Available on all supported chains.
Emits Swap and SwapMulti events.
V3
V3 router for enhanced swap functionality.
Available on all supported chains (unified address via CREATE2).
Emits Swap and SwapMulti events (with additional referral/slippage fields
compared to V2).
Implementations§
Source§impl RouterType
impl RouterType
Sourcepub const fn all() -> [RouterType; 3]
pub const fn all() -> [RouterType; 3]
Returns all possible router types.
Note: This includes both swap routers (V2, V3) and order routers (LimitOrder),
which emit different event types. For event processing, consider using
swap_routers() or order_routers()
instead.
Sourcepub const fn swap_routers() -> [RouterType; 2]
pub const fn swap_routers() -> [RouterType; 2]
Returns router types that emit Swap and SwapMulti events.
Use this when iterating over routers for swap event processing. Both V2 and V3 routers emit these events (with slightly different schemas).
§Example
use odos_sdk::RouterType;
// Process only routers that emit swap events
for router_type in RouterType::swap_routers() {
println!("Processing swap events for {:?}", router_type);
}Sourcepub const fn order_routers() -> [RouterType; 1]
pub const fn order_routers() -> [RouterType; 1]
Returns router types that emit limit order events (LimitOrderFilled, etc.).
Use this when iterating over routers for limit order event processing.
§Example
use odos_sdk::RouterType;
// Process only routers that emit limit order events
for router_type in RouterType::order_routers() {
println!("Processing order events for {:?}", router_type);
}Sourcepub const fn emits_swap_events(&self) -> bool
pub const fn emits_swap_events(&self) -> bool
Returns whether this router type emits Swap and SwapMulti events.
trueforV2andV3falseforLimitOrder
§Example
use odos_sdk::RouterType;
assert!(RouterType::V2.emits_swap_events());
assert!(RouterType::V3.emits_swap_events());
assert!(!RouterType::LimitOrder.emits_swap_events());Sourcepub const fn emits_order_events(&self) -> bool
pub const fn emits_order_events(&self) -> bool
Returns whether this router type emits limit order events.
trueforLimitOrderfalseforV2andV3
§Example
use odos_sdk::RouterType;
assert!(RouterType::LimitOrder.emits_order_events());
assert!(!RouterType::V2.emits_order_events());
assert!(!RouterType::V3.emits_order_events());Trait Implementations§
Source§impl Clone for RouterType
impl Clone for RouterType
Source§fn clone(&self) -> RouterType
fn clone(&self) -> RouterType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouterType
impl Debug for RouterType
Source§impl Display for RouterType
impl Display for RouterType
Source§impl Hash for RouterType
impl Hash for RouterType
Source§impl PartialEq for RouterType
impl PartialEq for RouterType
impl Copy for RouterType
impl Eq for RouterType
impl StructuralPartialEq for RouterType
Auto Trait Implementations§
impl Freeze for RouterType
impl RefUnwindSafe for RouterType
impl Send for RouterType
impl Sync for RouterType
impl Unpin for RouterType
impl UnwindSafe for RouterType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.