Uniswap / Uniswap/interface

ActiveTick is incorrectly determined for stablecoin pools.

Open
#7,675 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Quite often in stablecoin pairs, the current tick can be equal to zero. And this check does not work correctly.

const getActiveTick = (tickCurrent: number | undefined, feeAmount: FeeAmount | undefined) => tickCurrent && feeAmount ? Math.floor(tickCurrent / TICK_SPACINGS[feeAmount]) * TICK_SPACINGS[feeAmount] : undefined

I suggest as a replacement:

const getActiveTick = (tickCurrent: number | undefined, feeAmount: FeeAmount | undefined) => typeof tickCurrent === 'number' && feeAmount ? Math.floor(tickCurrent / TICK_SPACINGS[feeAmount]) * TICK_SPACINGS[feeAmount] : undefined

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

Search the TypeScript codebase for getActiveTick and inspect its callers. Verify behavior for tickCurrent=0 and normal tick values; done when zero is treated as valid and the active tick is calculated correctly for stablecoin pools.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.