ActiveTick is incorrectly determined for stablecoin pools.
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
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
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