diff --git a/x/concentrated-liquidity/export_test.go b/x/concentrated-liquidity/export_test.go index 8ea45290b54..35ede63a26e 100644 --- a/x/concentrated-liquidity/export_test.go +++ b/x/concentrated-liquidity/export_test.go @@ -143,8 +143,8 @@ func (k Keeper) SetPositionIdToLock(ctx sdk.Context, positionId, underlyingLockI k.setPositionIdToLock(ctx, positionId, underlyingLockId) } -func RoundTick(lowerTick, upperTick int64, priceTickLower, priceTickUpper sdk.Dec, tickSpacing uint64) (int64, int64, error) { - return roundTick(lowerTick, upperTick, priceTickLower, priceTickUpper, tickSpacing) +func RoundTickToCanonicalPriceTick(lowerTick, upperTick int64, priceTickLower, priceTickUpper sdk.Dec, tickSpacing uint64) (int64, int64, error) { + return roundTickToCanonicalPriceTick(lowerTick, upperTick, priceTickLower, priceTickUpper, tickSpacing) } // fees methods diff --git a/x/concentrated-liquidity/lp.go b/x/concentrated-liquidity/lp.go index f6fd6e03e8f..1237f389065 100644 --- a/x/concentrated-liquidity/lp.go +++ b/x/concentrated-liquidity/lp.go @@ -66,7 +66,7 @@ func (k Keeper) createPosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddr } // If multiple ticks can represent the same spot price, ensure we are using the largest of those ticks. - lowerTick, upperTick, err = roundTick(lowerTick, upperTick, priceLowerTick, priceUpperTick, pool.GetTickSpacing()) + lowerTick, upperTick, err = roundTickToCanonicalPriceTick(lowerTick, upperTick, priceLowerTick, priceUpperTick, pool.GetTickSpacing()) if err != nil { return 0, sdk.Int{}, sdk.Int{}, sdk.Dec{}, time.Time{}, 0, 0, err } diff --git a/x/concentrated-liquidity/tick.go b/x/concentrated-liquidity/tick.go index 2f6b41fbddf..ccbce906047 100644 --- a/x/concentrated-liquidity/tick.go +++ b/x/concentrated-liquidity/tick.go @@ -191,7 +191,7 @@ func validateTickRangeIsValid(tickSpacing uint64, lowerTick int64, upperTick int return nil } -// roundTick takes a tick and determines if multiple ticks can represent the same price as the provided tick. If so, it +// roundTickToCanonicalPriceTick takes a tick and determines if multiple ticks can represent the same price as the provided tick. If so, it // rounds that tick up to the largest tick that can represent the same price that the original tick corresponded to. If one of // the two ticks happen to be rounded, we re-validate the tick range to ensure that the tick range is still valid. // @@ -199,7 +199,7 @@ func validateTickRangeIsValid(tickSpacing uint64, lowerTick int64, upperTick int // the first tick (given our precision) that is able to represent this price is -161000000, so we use this tick instead. // // This really only applies to very small tick values, as the increment of a single tick continues to get smaller as the tick value gets smaller. -func roundTick(lowerTick, upperTick int64, priceTickLower, priceTickUpper sdk.Dec, tickSpacing uint64) (int64, int64, error) { +func roundTickToCanonicalPriceTick(lowerTick, upperTick int64, priceTickLower, priceTickUpper sdk.Dec, tickSpacing uint64) (int64, int64, error) { newLowerTick, err := math.PriceToTickRoundDown(priceTickLower, tickSpacing) if err != nil { return 0, 0, err diff --git a/x/concentrated-liquidity/tick_test.go b/x/concentrated-liquidity/tick_test.go index c36da27bf09..21a802e7099 100644 --- a/x/concentrated-liquidity/tick_test.go +++ b/x/concentrated-liquidity/tick_test.go @@ -1408,7 +1408,7 @@ func (s *KeeperTestSuite) TestGetAllInitializedTicksForPool() { } } -func (s *KeeperTestSuite) TestRoundTick() { +func (s *KeeperTestSuite) TestRoundTickToCanonicalPriceTick() { tests := []struct { name string lowerTick int64 @@ -1480,7 +1480,7 @@ func (s *KeeperTestSuite) TestRoundTick() { s.Require().NoError(err) // System Under Test - newLowerTick, newUpperTick, err := cl.RoundTick(test.lowerTick, test.upperTick, priceTickLower, priceTickUpper, DefaultTickSpacing) + newLowerTick, newUpperTick, err := cl.RoundTickToCanonicalPriceTick(test.lowerTick, test.upperTick, priceTickLower, priceTickUpper, DefaultTickSpacing) if test.expectedError != nil { s.Require().Error(err)