Uniswap / Uniswap/interface

`getAmountsOut` function returns the different value from what the Uniswap front-end shows

Open
#4,049 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Bug Description
I'm building a small dex platform of my own, and wanna let users know how much they can receive after the trade.

  • First approach
    I used getAmountsOut function in the Router contract, but the result was different from what the Uniswap front-end shows.

  • Second approach
    I gave it a try with bestAmountExactIn function in the Trade contract, but the same value as the one of what getAmountsOut returns

I guess Uniswap itself uses its own SDK under the hood,
But I'm not sure why the result is different.

Can anyone guide me on how I can resolve this issue?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Router contract's getAmountsOut result and the Trade contract's bestAmountExactIn result with the value shown by the Uniswap front-end. Trace how the front-end obtains its quote and identify the cause of the discrepancy; done means the difference is explained and the reported quote behavior is corrected or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain, typescript
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.