Imprecise fee tier distribution percentages
Open
Nobody has claimed this yet.
p0
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
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
totalValueLockedUSDortotalValueLockedETHfields from the graph
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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