Uniswap / v3-sdk

🛠 An SDK for building applications on top of Uniswap V3
MIT License
544 stars 416 forks source link

`encodeCollect` doesn't use `expectedCurrencyOwed` for `amount0Max`/`amount1Max` #168

Closed pdunc closed 1 year ago

pdunc commented 1 year ago

Inside nonfungiblePositionManager.ts, the encodeCollect function includes the following:

// collect
calldatas.push(
  NonfungiblePositionManager.INTERFACE.encodeFunctionData('collect', [
    {
      tokenId,
      recipient: involvesETH ? ADDRESS_ZERO : recipient,
      amount0Max: MaxUint128,
      amount1Max: MaxUint128
    }
  ])
)

MaxUint128 is used for both amount0Max and amount1Max. I think this should use options.expectedCurrencyOwedX.quotient

With the current behavior, when the transaction involvesETH (or any Native Token), any excess native currency/token will not be respectively unwrapped or swept.