Skip to content

Commit

Permalink
Refactor tick value clamping and bump package version (#47)
Browse files Browse the repository at this point in the history
The tick value clamping in 'src/entities/pool.rs' has been refactored to use the built-in clamp method for more efficient and readable code. Additionally, the package version in 'Cargo.toml' has been updated from 0.28.0 to 0.29.0.
  • Loading branch information
shuhuiluo authored Apr 14, 2024
1 parent 390f411 commit 959b75c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uniswap-v3-sdk"
version = "0.28.0"
version = "0.29.0"
edition = "2021"
authors = ["Shuhui Luo <twitter.com/aureliano_law>"]
description = "Uniswap V3 SDK for Rust"
Expand Down
6 changes: 1 addition & 5 deletions src/entities/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,7 @@ where
self.tick_spacing(),
)?;

if step.tick_next < MIN_TICK {
step.tick_next = MIN_TICK;
} else if step.tick_next > MAX_TICK {
step.tick_next = MAX_TICK;
}
step.tick_next = step.tick_next.clamp(MIN_TICK, MAX_TICK);

step.sqrt_price_next_x96 = get_sqrt_ratio_at_tick(step.tick_next)?;
(
Expand Down

0 comments on commit 959b75c

Please sign in to comment.