feat: Add validation for cyclical trades

We only support cyclical trades when the repeated token is the first and the last token in the swap. We don't support cycles in between

--- don't change below this line ---
ENG-4331 Took 2 hours 4 minutes

(cherry picked from commit 55ffa4eb45)

Took 5 minutes


Took 2 minutes
This commit is contained in:
Diana Carvalho
2025-03-13 16:13:28 +00:00
parent c7c46ba671
commit f62a9d28c0
2 changed files with 169 additions and 1 deletions

View File

@@ -25,7 +25,6 @@ impl SwapEncoderBuilder {
"uniswap_v2" => Ok(Box::new(UniswapV2SwapEncoder::new(self.executor_address))),
"vm:balancer_v2" => Ok(Box::new(BalancerV2SwapEncoder::new(self.executor_address))),
"uniswap_v3" => Ok(Box::new(UniswapV3SwapEncoder::new(self.executor_address))),
// TODO replace this with V4 encoder once implemented
"uniswap_v4" => Ok(Box::new(UniswapV4SwapEncoder::new(self.executor_address))),
_ => Err(EncodingError::FatalError(format!(
"Unknown protocol system: {}",