Uniswap / v3-sdk

🛠 An SDK for building applications on top of Uniswap V3
MIT License
544 stars 416 forks source link

UNI V3 Invariant failed: TICK_LOWER #153

Open muhammadsamir11 opened 1 year ago

muhammadsamir11 commented 1 year ago

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

haltakov commented 1 year ago

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

SaltySousChef commented 1 year ago

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.

muhammadsamir11 commented 1 year ago

@SaltySousChef How to get the pool fee?

muhammadsamir11 commented 1 year ago

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

SaltySousChef commented 1 year ago

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.

satnam2609 commented 9 months ago

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