Skip to content

Commit

Permalink
Remove extra code path in TickToPrice (#7598) (#7602)
Browse files Browse the repository at this point in the history
* Minor CL tick speedups

* undo feature for another commit

(cherry picked from commit 3c2386a)

Co-authored-by: Dev Ojha <[email protected]>
  • Loading branch information
mergify[bot] and ValarDragon authored Feb 24, 2024
1 parent 2c87d84 commit 7b7ed40
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions x/concentrated-liquidity/math/tick.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,8 @@ func TickToPrice(tickIndex int64) (osmomath.BigDec, error) {
numAdditiveTicks := tickIndex - (geometricExponentDelta * geometricExponentIncrementDistanceInTicks)
additiveSpacing := currentAdditiveIncrementInTicks.MulInt64(numAdditiveTicks)

var price osmomath.BigDec

// Finally, we can calculate the price
// Note that to maintain backwards state-compatibility, we utilize the
// original math based on 18 precision decimal on the range of [MinInitializedTick, tick(MaxSpotPrice)]
// For the newly extended range of [MinInitializedTickV2, MinInitializedTick), we use the new math
// based on 36 precision decimal.
// TODO: Delete this code difference, it yields the exact same number every time.
if tickIndex < types.MinInitializedTick {
price = additiveSpacing.AddMut(powTenBigDec(geometricExponentDelta))
} else {
price = osmomath.BigDecFromDecMut((additiveSpacing.Dec()).AddMut(PowTenInternal(geometricExponentDelta)))
}
price := additiveSpacing.AddMut(powTenBigDec(geometricExponentDelta))

// defense in depth, this logic would not be reached due to use having checked if given tick is in between
// min tick and max tick.
Expand Down

0 comments on commit 7b7ed40

Please sign in to comment.