Skip to content

Commit

Permalink
Remove extra code path in TickToPrice (#7598)
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)
  • Loading branch information
ValarDragon authored and mergify[bot] committed Feb 24, 2024
1 parent db6cb8c commit 058e33e
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 058e33e

Please sign in to comment.