Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output trade fails on Uniswap V2 #36

Open
terence-crypto opened this issue Feb 24, 2022 · 3 comments
Open

Output trade fails on Uniswap V2 #36

terence-crypto opened this issue Feb 24, 2022 · 3 comments

Comments

@terence-crypto
Copy link

terence-crypto commented Feb 24, 2022

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

@hustynetwork
Copy link

hustynetwork commented Jul 12, 2022

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 :
image

However when I manually tried to increase the value of "amountInMax" it works.

@tyleung
Copy link

tyleung commented Jul 14, 2022

@hustynetwork Yeah, I removed the second conditional here

uniswapVersion === UniswapVersion.v3
and it seems to work fine so far.

@hustynetwork
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants