pancake-frontend icon indicating copy to clipboard operation
pancake-frontend copied to clipboard

fix: Invariant crash when adding liquidity

Open memoyil opened this issue 5 months ago • 2 comments

It happens some of the no-liquidity/not yet created pools with min/max price on the params

https://pancakeswap.finance/add/0xCF18E4ff8433D32d8d2CC17C7674dbAea01DBA63/BNB/100?minPrice=0.000000000000000000&maxPrice=340256786836388094070642339899681172762.184832000000000000


PR-Codex overview

This PR improves error handling in the RangeSelector component by wrapping logic in try-catch blocks. This ensures that if an error occurs during the calculation of price values, the function will return an empty string instead of potentially causing a runtime error.

Detailed summary

  • Added try-catch blocks around price calculations for leftPrice and rightPrice.
  • Ensured that if an error occurs, the function returns an empty string.
  • Maintained existing logic for returning '0' or '∞' based on tickSpaceLimits.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

memoyil avatar Sep 10 '24 19:09 memoyil