feat: Add interacting_with to EncodedSolution

- Remove encode_full_calldata from the TychoEncoder trait
- Make the TychoExecutorEncoder use encode_solutions instead of encode_full_calldata
- Update tycho-encode.rs accordingly

Took 1 hour 3 minutes


Took 12 seconds
This commit is contained in:
Diana Carvalho
2025-05-21 18:00:19 +01:00
parent 08056c4a6c
commit facdf716bd
8 changed files with 174 additions and 299 deletions

View File

@@ -1,6 +1,6 @@
use crate::encoding::{
errors::EncodingError,
models::{EncodedSolution, Solution, Transaction},
models::{EncodedSolution, Solution},
};
/// A high-level interface for encoding solutions into Tycho-compatible transactions or raw call
@@ -47,22 +47,6 @@ pub trait TychoEncoder {
solutions: Vec<Solution>,
) -> Result<Vec<EncodedSolution>, EncodingError>;
/// Encodes a list of [`Solution`]s directly into executable transactions for the Tycho router.
///
/// This method wraps around Tychos example encoding logic (see [`encode_tycho_router_call`])
/// and should only be used for **prototyping or development**.
///
/// # Warning
/// This implementation uses default logic to construct the outer calldata (e.g., for setting
/// `minAmountOut`). This might not be optimal or safe for production use.
///
/// To ensure correctness, **users should implement their own encoding pipeline** using
/// [`encode_solutions`].
///
/// # Returns
/// A vector of fully constructed [`Transaction`]s that can be submitted to a node or bundler.
fn encode_calldata(&self, solutions: Vec<Solution>) -> Result<Vec<Transaction>, EncodingError>;
/// Performs solution-level validation and sanity checks.
///
/// This function can be used to verify whether a proposed solution is structurally sound and