Open smsunarto opened 3 years ago
+1
The official example doesn't even compile due to a "stack too deep" error given by: (, , address token0, address token1, , , , uint128 liquidity, , , , ) = nonfungiblePositionManager.positions(tokenId);
Even if you somehow figure how to convert that to a low level call (detailed here), you still get the Pool.mint function reverting without an error.
Please help us build things for your product. Please provide one working example of adding & removing liquidity. Thanks.
EDIT: FOUND THE ISSUE!
The official example has a range of TickMath.MIN_TICK to TickMath.MAX_TICK. These are wrong! They are the theoretical limits of TickMath, not the values you should use for the pool. The tickLower and tickUpper values have to be within the range of -Pool.slot0.tick and Pool.slot0.tick, otherwise the transaction silently fails. The SDK example with "nearestUsableTick" shows a better way to calculate the values.
Please fix this issue ASAP.
A lot of teams in HackMoney hackathon (which Uniswap Grants sponsors) struggled in figuring out how to provide liquidity via NonfungiblePositionManager through a smart contract.
A simple example on the following would go a long way: