v3-sdk icon indicating copy to clipboard operation
v3-sdk copied to clipboard

UNI V3 Invariant failed: TICK_LOWER

Open muhammadsamir11 opened this issue 2 years ago • 6 comments

Can anyone help me to solve this issue "Invariant failed: TICK_LOWER"

muhammadsamir11 avatar Nov 05 '22 03:11 muhammadsamir11

You tick is probably not according to the tick spacing. Try using nearestUsableTick to get a valid tick.

haltakov avatar Nov 09 '22 00:11 haltakov

Or the pool you are trying to use is at the minimum tick and cannot get "TICK_LOWER" because there is no lower usable tick.

SaltySousChef avatar Dec 11 '22 02:12 SaltySousChef

@SaltySousChef How to get the pool fee?

muhammadsamir11 avatar Dec 14 '22 02:12 muhammadsamir11

What is the best way to calculate underlying assets of univ3 pool?

muhammadsamir11 avatar Dec 14 '22 03:12 muhammadsamir11

The easiest way to get both of those values is via Uniswap's graph. If you want to do it in code you can create an instance of the pool in your language of choice and call Slot0 which will return the global state for the pool and contains the fee, current tick, liquidity and sqrtPrice which can allow you to figure out the virtual reserves. The math for this and figuring out the real reserves is in the whitepaper.

SaltySousChef avatar Dec 14 '22 03:12 SaltySousChef

Probably you have not used the correct pool address or pool hash code

satnam2609 avatar Oct 29 '23 04:10 satnam2609