Uniswap / Uniswap/interface

Imprecise fee tier distribution percentages

Open
#3,632 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

On
https://github.com/Uniswap/interface/blob/c0bdb8db123350a3a6201b3a75211e4de94f9140/src/hooks/useFeeTierDistribution.ts#L154

the way the liquidity distribution among fee tiers is calculated, it's adding the TVL of both base and quote which doesn't make sense to me. E.g. if for the pair WETH/DAI you have 2 fee tiers:

  • One with 999 DAI and 1 WETH
  • One with 1 DAI and 999 WETH
    Following that calculation they would show on the UI as 50%-50% ((1+999)/2000), but it's obvious the second has much more TVL.
    It's a bit of an extreme example, i've been playing with some pools and values are still off by a few percentage points.

I believe it would make more sense to either

  • transform the TVL for one of the tokens to an equivalent of the other one using the pool's price, or
  • use totalValueLockedUSD or totalValueLockedETH fields from the graph

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 at src/hooks/useFeeTierDistribution.ts around line 154 and inspect how base and quote TVL are combined. Compare the available pool value fields mentioned in the issue and how the resulting percentages reach the UI. Done means the displayed fee-tier distribution reflects pool value rather than simply adding both token amounts, including the WETH/DAI example.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.