Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Providing low input amount raises an error that's never returned #66

Open
fomotrader opened this issue May 12, 2021 · 1 comment
Open

Comments

@fomotrader
Copy link

As a developer testing out the uniswap SDK, when an error is raised because the input amount I provided is too low, instead of returning that and surfacing it up to me. The SDK just swallows it and silently carries before another part of my code blows up.

Why do we do that?

https://github.com/Uniswap/uniswap-v2-sdk/blob/main/src/entities/trade.ts#L266

@Florian-S-A-W
Copy link

Florian-S-A-W commented May 9, 2023

Pair.getOutputAmount can throw the InsufficientInputAmount error when a swap would result in 0 output, the involvesToken invariant, as well as the InsufficientReservesError are already checked before that. In all cases it makes sense to consider this Pair as invalid and continue with the loop. If all pairs are invalid, the result of the recursive function will just be an empty Array.

royalaid pushed a commit to royalaid/qidao-sdk that referenced this issue Feb 7, 2024
…rmony

fix multicall on harmony and and new zkevm collaterals
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants