Content
@
0 reply
0 recast
0 reaction
Adam
@adamtj-xyz
has anyone run into the error "panic: arithmetic underflow or overflow" when adding liquidity? My math is probably wrong lol I'm using the liquidity amount library in v4 to figure out how much liquidity i need to add to my pool. https://github.com/atj3097/nft-amm-hook/blob/master/test/NFTAMMHook.t.sol#L131-L163
2 replies
0 recast
0 reaction
Adam
@adamtj-xyz
having a hard time seeing where this panic is happening. i think its in under modifyLiquidity in the poolmodifytest or the arithmetic happening in the pool manager's settle function. https://github.com/Uniswap/v4-core/blob/f5674e46720c0fc4606b287cccc583d56245e724/src/PoolManager.sol#L265-L270
1 reply
0 recast
0 reaction
Haardik
@haardikkk
I can try helping debug this tomorrow but you can add logging to the poolmodifyliquditytest router to try and figure out where it’s happening exactly - since we deploy that ourselves during tests
1 reply
0 recast
1 reaction
Adam
@adamtj-xyz
hey @haardikkk , the arithmetic panic is happening here https://github.com/Uniswap/v4-core/blob/f5674e46720c0fc4606b287cccc583d56245e724/src/test/PoolTestBase.sol#L35
1 reply
0 recast
0 reaction
Adam
@adamtj-xyz
For context, the value that I'm passing in as the amount is -5, which is then turned positive. When checking the balance of the payer they have like 100000 tokens of the particular currency being unwrapped. its kind of confusing cause the panic is happening on the transfer function according to the logs
2 replies
0 recast
0 reaction