GPT-5 finding
Swap path does not guard against zero amountIn, leading to revert on exactInputSingle
mediumbughigh
- scripts/reposition.ts:355-367
- scripts/reposition.ts:373-389
If post-collect balance is very small, dividing by 2n can yield 0n. Uniswap V3 exactInputSingle with amountIn=0 will revert, aborting the whole reposition flow.
Recommendation
Before approving and calling exactInputSingle, add a guard: if (swapAmountIn === 0n) skip the swap step and proceed to mint with current balances. Optionally log a message.