- It has two three methods to be created: - new: where the user can pass any custom StrategyEncoder - tycho_router: where the default SplitSwapStrategyEncoder with Tycho Router will be used - direct_execution: where the user can encode only the execution data and integrate this into their workflow. - This replaces StrategyEncoderRegistry - EVMTychoEncoder holds directly the StrategyEncoder and not the registry (per one init of the EVMTychoEncoder there is only one possible StrategyEncoder) - Update quickstart - Update bin (add subcommands to bin to create a different instance of EVMEncoderBuilder) --- don't change below this line --- ENG-4246 Took 33 minutes Took 38 seconds Took 38 seconds
16 lines
507 B
Rust
16 lines
507 B
Rust
use tycho_core::Bytes;
|
|
|
|
use crate::encoding::{errors::EncodingError, models::Solution, swap_encoder::SwapEncoder};
|
|
|
|
/// Encodes a solution using a specific strategy.
|
|
pub trait StrategyEncoder {
|
|
fn encode_strategy(
|
|
&self,
|
|
to_encode: Solution,
|
|
) -> Result<(Vec<u8>, Bytes, Option<String>), EncodingError>;
|
|
|
|
#[allow(clippy::borrowed_box)]
|
|
fn get_swap_encoder(&self, protocol_system: &str) -> Option<&Box<dyn SwapEncoder>>;
|
|
fn clone_box(&self) -> Box<dyn StrategyEncoder>;
|
|
}
|