fix: Remove router_address from Solution object

after merge
This commit is contained in:
TAMARA LIPOWSKI
2025-04-03 23:14:32 +02:00
committed by Diana Carvalho
parent 11a05e4f18
commit fcedd39f30

View File

@@ -62,7 +62,7 @@ pub struct SingleSwapStrategyEncoder {
impl SingleSwapStrategyEncoder { impl SingleSwapStrategyEncoder {
pub fn new( pub fn new(
blockchain: tycho_core::models::Chain, blockchain: tycho_common::models::Chain,
swap_encoder_registry: SwapEncoderRegistry, swap_encoder_registry: SwapEncoderRegistry,
swapper_pk: Option<String>, swapper_pk: Option<String>,
router_address: Bytes, router_address: Bytes,
@@ -137,7 +137,7 @@ impl StrategyEncoder for SingleSwapStrategyEncoder {
let encoding_context = EncodingContext { let encoding_context = EncodingContext {
receiver: self.router_address.clone(), receiver: self.router_address.clone(),
exact_out: solution.exact_out, exact_out: solution.exact_out,
router_address: self.router_address.clone(), router_address: Some(self.router_address.clone()),
group_token_in: grouped_swap.input_token.clone(), group_token_in: grouped_swap.input_token.clone(),
group_token_out: grouped_swap.output_token.clone(), group_token_out: grouped_swap.output_token.clone(),
}; };
@@ -927,7 +927,6 @@ mod tests {
checked_amount, checked_amount,
sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(), sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(), receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
router_address: Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap(),
swaps: vec![swap], swaps: vec![swap],
..Default::default() ..Default::default()
}; };
@@ -1043,9 +1042,13 @@ mod tests {
split: 0f64, split: 0f64,
}; };
let swap_encoder_registry = get_swap_encoder_registry(); let swap_encoder_registry = get_swap_encoder_registry();
let encoder = let encoder = SplitSwapStrategyEncoder::new(
SplitSwapStrategyEncoder::new(eth_chain(), swap_encoder_registry, Some(private_key)) eth_chain(),
.unwrap(); swap_encoder_registry,
Some(private_key),
Some(Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap()),
)
.unwrap();
let solution = Solution { let solution = Solution {
exact_out: false, exact_out: false,
given_token: eth(), given_token: eth(),
@@ -1055,7 +1058,6 @@ mod tests {
checked_amount: Some(BigUint::from_str("2659881924818443699787").unwrap()), checked_amount: Some(BigUint::from_str("2659881924818443699787").unwrap()),
sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(), sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(), receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
router_address: Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap(),
swaps: vec![swap], swaps: vec![swap],
native_action: Some(NativeAction::Wrap), native_action: Some(NativeAction::Wrap),
..Default::default() ..Default::default()
@@ -1461,7 +1463,6 @@ mod tests {
checked_amount, checked_amount,
sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(), sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(), receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
router_address: Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap(),
swaps: vec![swap], swaps: vec![swap],
..Default::default() ..Default::default()
}; };