pub struct Swap {
pub component: ProtocolComponent,
pub token_in: Bytes,
pub token_out: Bytes,
pub split: f64,
pub user_data: Option<Bytes>,
pub protocol_state: Option<Arc<dyn ProtocolSim>>,
pub estimated_amount_in: Option<BigUint>,
}Expand description
Represents a swap operation to be performed on a pool.
Fields§
§component: ProtocolComponentProtocol component from tycho indexer
token_in: BytesToken being input into the pool.
token_out: BytesToken being output from the pool.
split: f64Decimal of the amount to be swapped in this operation (for example, 0.5 means 50%)
user_data: Option<Bytes>Optional user data to be passed to encoding.
protocol_state: Option<Arc<dyn ProtocolSim>>Optional protocol state used to perform the swap.
estimated_amount_in: Option<BigUint>Optional estimated amount in for this Swap. This is necessary for RFQ protocols. This value is used to request the quote
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Swap
impl<'de> Deserialize<'de> for Swap
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !Freeze for Swap
impl !RefUnwindSafe for Swap
impl Send for Swap
impl Sync for Swap
impl Unpin for Swap
impl !UnwindSafe for Swap
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more