pub trait StrategyEncoder {
// Required methods
fn encode_strategy(
&self,
solution: &Solution,
) -> Result<EncodedSolution, EncodingError>;
fn get_swap_encoder(
&self,
protocol_system: &str,
) -> Option<&Box<dyn SwapEncoder>>;
fn clone_box(&self) -> Box<dyn StrategyEncoder>;
}Expand description
A trait that defines how to encode a Solution for execution.
Required Methods§
Sourcefn 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.
§Arguments
solution- TheSolutionto encode, containing swap details, amounts, and execution path
§Returns
Result<EncodedSwaps, EncodingError>
Sourcefn get_swap_encoder(
&self,
protocol_system: &str,
) -> Option<&Box<dyn SwapEncoder>>
fn get_swap_encoder( &self, protocol_system: &str, ) -> Option<&Box<dyn SwapEncoder>>
Sourcefn clone_box(&self) -> Box<dyn StrategyEncoder>
fn clone_box(&self) -> Box<dyn StrategyEncoder>
Creates a cloned instance of the strategy encoder.