Skip to content

Commit

Permalink
clean up boundary check
Browse files Browse the repository at this point in the history
  • Loading branch information
AlpinYukseloglu committed Jun 19, 2023
1 parent 3069a23 commit 7c6f256
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x/concentrated-liquidity/math/tick.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func CalculateSqrtPriceToTick(sqrtPrice sdk.Dec) (tickIndex int64, err error) {
// For cases where calculated tick falls on a limit, the upper end is inclusive, since the actual tick is
// already shifted and making it exclusive would make min/max tick impossible to reach by construction.
// We do this primary for code simplicity, as alternatives would require more branching and special cases.
if (!outOfBounds && sqrtPrice.GTE(sqrtPriceTplus2)) || sqrtPrice.LT(sqrtPriceTmin1) || sqrtPrice.GT(sqrtPriceTplus2) {
if (!outOfBounds && sqrtPrice.GTE(sqrtPriceTplus2)) || (outOfBounds && sqrtPrice.GT(sqrtPriceTplus2)) || sqrtPrice.LT(sqrtPriceTmin1) {
return 0, fmt.Errorf("sqrt price to tick could not find a satisfying tick index. Hit bounds: %v", outOfBounds)
}

Expand Down

0 comments on commit 7c6f256

Please sign in to comment.