Skip to content

Commit

Permalink
Fix active_tick_index assertion (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
die-herdplatte authored Oct 22, 2024
1 parent e8d7698 commit 0eb9947
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/quoting/base_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,11 @@ impl BasePool {
);
} else {
if let Some(first) = sorted_ticks.first() {
if state.sqrt_ratio
> to_sqrt_ratio(first.index).expect("first tick has invalid index")
{
if let Some(last) = sorted_ticks.last() {
assert!(
state.sqrt_ratio
>= to_sqrt_ratio(last.index).expect("last tick has invalid index"),
"tick must be outside first and last tick if active_tick_index is none"
);
}
}
assert!(
state.sqrt_ratio
<= to_sqrt_ratio(first.index).expect("first tick has invalid index"),
"current sqrt_ratio must be lower than equal sqrt_ratio of first tick if active_tick_index is none"
);
}
}

Expand Down

0 comments on commit 0eb9947

Please sign in to comment.