pub struct SingleSwapStrategyEncoder { /* private fields */ }Expand description
Represents the encoder for a swap strategy which supports single swaps.
§Fields
swap_encoder_registry: SwapEncoderRegistry, containing all possible swap encodersfunction_signature: String, the signature for the swap function in the router contractrouter_address: Address of the router to be used to execute swapstransfer_optimization: TransferOptimization, responsible for optimizing the token transfershistorical_trade: Whether the swap is to be done in the current block or in an historical one. This is relevant for checking token approvals in some protocols (like Balancer v2).
Implementations§
Source§impl SingleSwapStrategyEncoder
impl SingleSwapStrategyEncoder
pub fn new( chain: Chain, swap_encoder_registry: SwapEncoderRegistry, user_transfer_type: UserTransferType, router_address: Bytes, historical_trade: bool, ) -> Result<Self, EncodingError>
Trait Implementations§
Source§impl Clone for SingleSwapStrategyEncoder
impl Clone for SingleSwapStrategyEncoder
Source§fn clone(&self) -> SingleSwapStrategyEncoder
fn clone(&self) -> SingleSwapStrategyEncoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl StrategyEncoder for SingleSwapStrategyEncoder
impl StrategyEncoder for SingleSwapStrategyEncoder
Source§fn encode_strategy(
&self,
solution: &Solution,
) -> Result<EncodedSolution, EncodingError>
fn encode_strategy( &self, solution: &Solution, ) -> Result<EncodedSolution, EncodingError>
encode_strategy takes a Solution, which contains all the necessary information about
the swaps to be performed, and encodes it into a format that can be executed by the router
or executor contracts. Read moreSource§fn get_swap_encoder(
&self,
protocol_system: &str,
) -> Option<&Box<dyn SwapEncoder>>
fn get_swap_encoder( &self, protocol_system: &str, ) -> Option<&Box<dyn SwapEncoder>>
Retrieves the swap encoder for a specific protocol system. Read more
Source§fn clone_box(&self) -> Box<dyn StrategyEncoder>
fn clone_box(&self) -> Box<dyn StrategyEncoder>
Creates a cloned instance of the strategy encoder.
Auto Trait Implementations§
impl !Freeze for SingleSwapStrategyEncoder
impl !RefUnwindSafe for SingleSwapStrategyEncoder
impl Send for SingleSwapStrategyEncoder
impl Sync for SingleSwapStrategyEncoder
impl Unpin for SingleSwapStrategyEncoder
impl !UnwindSafe for SingleSwapStrategyEncoder
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