From 7c6f2562d6895e5ba3618512d28333aaa0cb14eb Mon Sep 17 00:00:00 2001 From: alpo Date: Mon, 19 Jun 2023 08:12:31 -0700 Subject: [PATCH] clean up boundary check --- x/concentrated-liquidity/math/tick.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/concentrated-liquidity/math/tick.go b/x/concentrated-liquidity/math/tick.go index 1e74ba16174..4023929d5b0 100644 --- a/x/concentrated-liquidity/math/tick.go +++ b/x/concentrated-liquidity/math/tick.go @@ -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) }