v2-periphery icon indicating copy to clipboard operation
v2-periphery copied to clipboard

v3 can pull in less than amountIn, can uni v2?

Open NatPDeveloper opened this issue 1 year ago • 0 comments

So it came to my attention recently that uni v3 can pull in less than the amount in specified for a swap if there's insufficient liquidity.

I'm curious if uniswap v2 can do this as well. It looks like no but it would be great to be sure as the scenario I mentioned above is not in the docs. https://github.com/Uniswap/v2-periphery/blob/master/contracts/libraries/UniswapV2Library.sol#L65

UniV3 https://github.com/Uniswap/v3-core/blob/d8b1c635c275d2a9450bd6a78f3fa2484fef73eb/contracts/UniswapV3Pool.sol#L563 https://github.com/Uniswap/v3-core/blob/main/contracts/UniswapV3Pool.sol#L767

I would suggest adding the above scenario to the docs for those developing smart contracts on top of the protocol this can lead to forever locked funds.

NatPDeveloper avatar Jul 19 '23 19:07 NatPDeveloper