feat: Refactor TychoEncoder
We have a trait TychoEncoder and then two implementations: TychoRouterEncoder and TychoExecutorEncoder. This way we go a level above with the decision if it is a direct execution or if it should use the tycho router. - Created two builders: one for each tycho encoder - Delete ExecutorStrategyEncoder and move code straight into the TychoExecutorEncoder - Add validate_solution to trait TychoEncoder - Move group_swaps.rs a level up - Update tests and usage cases Doing this we get rid of all that weird stuff we were doing before --- don't change below this line --- ENG-4306 Took 2 hours 6 minutes Took 12 seconds
This commit is contained in:
@@ -14,8 +14,7 @@ pub trait TychoEncoder {
|
||||
///
|
||||
/// # Returns
|
||||
/// * `Result<Vec<Transaction>, EncodingError>` - Vector of executable transactions
|
||||
fn encode_router_calldata(
|
||||
&self,
|
||||
solutions: Vec<Solution>,
|
||||
) -> Result<Vec<Transaction>, EncodingError>;
|
||||
fn encode_calldata(&self, solutions: Vec<Solution>) -> Result<Vec<Transaction>, EncodingError>;
|
||||
|
||||
fn validate_solution(&self, solution: &Solution) -> Result<(), EncodingError>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user