Open terence-crypto opened 2 years ago
Did you find a work around yet? I'm stuck with the same issue. If I change the value in second input (Exact out), the transaction data's "amountInMax" is less than "expectedConvertQuote".
Hence I'm stuck with this error :
However when I manually tried to increase the value of "amountInMax" it works.
@hustynetwork Yeah, I removed the second conditional here https://github.com/joshstevens19/simple-uniswap-sdk/blob/1629b680e615ce9851a4f7e7a3ba0187beac8261/src/factories/router/uniswap-router.factory.ts#L1935 and it seems to work fine so far.
@tyleung Thanks for the comment. I'm new to modifying things on node_modules directly. Can you suggest me how did you edit the file and added it into your project? When I forked and added the project, there is no "dist" file in node_modules.
I found a potential bug in the code used to get the amountInMax:
https://github.com/uniswap-integration/simple-uniswap-sdk/blob/1629b680e615ce9851a4f7e7a3ba0187beac8261/src/factories/router/uniswap-router.factory.ts#L1935
Not sure why there's a check there for
UniswapVersion.v3
, but seems like this line causes output trades on Uniswap V2 to fail with EXCESSIVE_INPUT_AMOUNT because it subtracts the slippage, resulting in an amountInMax value lower than the expected amount.Probably related to issue: #28