feat: Extend Swap to hold user_data: Option<Bytes>

Took 25 minutes
This commit is contained in:
Diana Carvalho
2025-06-05 15:47:40 +01:00
parent 902c4cd4d2
commit eec50f8822
8 changed files with 142 additions and 4 deletions

View File

@@ -558,6 +558,7 @@ mod tests {
token_in: weth.clone(),
token_out: dai.clone(),
split: 0f64,
user_data: None,
};
let swap_encoder_registry = get_swap_encoder_registry();
let encoder = SingleSwapStrategyEncoder::new(
@@ -618,6 +619,7 @@ mod tests {
token_in: weth.clone(),
token_out: dai.clone(),
split: 0f64,
user_data: None,
};
let swap_encoder_registry = get_swap_encoder_registry();
let encoder = SingleSwapStrategyEncoder::new(
@@ -688,6 +690,7 @@ mod tests {
token_in: weth.clone(),
token_out: wbtc.clone(),
split: 0f64,
user_data: None,
};
let swap_wbtc_usdc = Swap {
component: ProtocolComponent {
@@ -698,6 +701,7 @@ mod tests {
token_in: wbtc.clone(),
token_out: usdc.clone(),
split: 0f64,
user_data: None,
};
let swap_encoder_registry = get_swap_encoder_registry();
let encoder = SequentialSwapStrategyEncoder::new(
@@ -789,6 +793,7 @@ mod tests {
token_in: usdc.clone(),
token_out: weth.clone(),
split: 0.6f64, // 60% of input
user_data: None,
};
// USDC -> WETH (Pool 2) - 40% of input (remaining)
@@ -809,7 +814,8 @@ mod tests {
},
token_in: usdc.clone(),
token_out: weth.clone(),
split: 0f64, // Remaining 40%
split: 0f64,
user_data: None, // Remaining 40%
};
// WETH -> USDC (Pool 2)
@@ -831,6 +837,7 @@ mod tests {
token_in: weth.clone(),
token_out: usdc.clone(),
split: 0.0f64,
user_data: None,
};
let swap_encoder_registry = get_swap_encoder_registry();
@@ -938,6 +945,7 @@ mod tests {
token_in: usdc.clone(),
token_out: weth.clone(),
split: 0.0f64,
user_data: None,
};
let swap_weth_usdc_v3_pool1 = Swap {
@@ -958,6 +966,7 @@ mod tests {
token_in: weth.clone(),
token_out: usdc.clone(),
split: 0.6f64,
user_data: None,
};
let swap_weth_usdc_v3_pool2 = Swap {
@@ -978,6 +987,7 @@ mod tests {
token_in: weth.clone(),
token_out: usdc.clone(),
split: 0.0f64,
user_data: None,
};
let swap_encoder_registry = get_swap_encoder_registry();