chore: cleanup

This commit is contained in:
royvardhan
2025-03-11 00:51:39 +05:30
parent bd504a8fed
commit 525560ea16
4 changed files with 18 additions and 22 deletions

View File

@@ -206,7 +206,7 @@ impl StrategyEncoder for SplitSwapStrategyEncoder {
}
let encoded_swaps = self.ple_encode(swaps);
let tokens_len = if &solution.given_token == &solution.checked_token {
let tokens_len = if solution.given_token == solution.checked_token {
tokens.len() - 1
} else {
tokens.len()
@@ -1306,11 +1306,11 @@ mod tests {
fn test_split_input_cyclic_swap() {
// This test has start and end tokens that are the same
// The flow is:
// ┌─── WETH (USV3 Pool 1) ───┐
//
// USDC (60% split) ─┤ ─> USDC
//
// └─── WETH (USV3 Pool 2) ───┘
// ┌─ (USV3, 60% split) ──> WETH ─┐
//
// USDC ──────┤ ├──(USV2)──> USDC
//
// └─ (USV3, 40% split) ──> WETH ─┘
// Set up a mock private key for signing (Alice's pk in our router tests)
let private_key =

View File

@@ -143,16 +143,12 @@ impl SplitSwapValidator {
// Build directed graph of token flows
let mut graph: HashMap<&Bytes, HashSet<&Bytes>> = HashMap::new();
let mut all_tokens = HashSet::new();
for swap in swaps {
graph
.entry(&swap.token_in)
.or_default()
.insert(&swap.token_out);
}
// Collect all unique tokens from the swaps
let mut all_tokens = HashSet::new();
for swap in swaps {
all_tokens.insert(&swap.token_in);
all_tokens.insert(&swap.token_out);
}
@@ -321,7 +317,7 @@ mod tests {
},
token_in: usdc.clone(),
token_out: weth.clone(),
split: 0.5,
split: 0f64,
},
Swap {
component: ProtocolComponent {
@@ -331,7 +327,7 @@ mod tests {
},
token_in: weth.clone(),
token_out: usdc.clone(),
split: 0.5,
split: 0f64,
},
];