fix: "Unable to determine current pool tick" on /app/cheats page #2

Closed
opened 2026-04-05 16:14:03 +00:00 by johba · 3 comments
Owner

Problem

The Liquidity Snapshot section on /app/cheats shows the error:

Unable to determine current pool tick

Clicking Refresh reproduces the same error. No console errors are visible to the user.

Reported in codeberg#1191.

Root cause

In web-app/src/views/CheatsView.vue, the loadLiquidityStats() function calls slot0() on the Uniswap V3 pool and parses the response as a named object:

let currentTick: number | null = null;
if (isRecord(slot0Response) && typeof slot0Response.tick === 'number') {
  currentTick = slot0Response.tick;
}

viem v2 returns multi-output contract calls as plain arrays, not named objects. slot0() has 7 outputs, so viem returns:

[195719044954189908619660483n, -120075, 3, 100, 100, 0, true]
//  sqrtPriceX96              tick     observationIndex  ...

isRecord() passes (arrays are objects in JS), but slot0Response.tick is undefined because arrays don't have a .tick property. So currentTick stays null and the error is thrown.

Reproduction

  1. Start the harb stack (docker compose up -d)
  2. Open http://localhost:5173/cheats
  3. The Liquidity Snapshot card shows: Unable to determine current pool tick
  4. Verified via cast call that slot0() returns valid data (tick = -120075)

Fix

Destructure slot0Response as an array (index [1] is the tick):

const slot0Array = slot0Response as readonly [bigint, number, ...unknown[]];
currentTick = Number(slot0Array[1]);

Note: the same file already handles both array and record shapes for the positions() call via toPosition() — a similar pattern should be used here for consistency.

Files

  • web-app/src/views/CheatsView.vueloadLiquidityStats(), around line 558
## Problem The Liquidity Snapshot section on `/app/cheats` shows the error: > Unable to determine current pool tick Clicking Refresh reproduces the same error. No console errors are visible to the user. Reported in [codeberg#1191](https://codeberg.org/johba/harb/issues/1191). ## Root cause In `web-app/src/views/CheatsView.vue`, the `loadLiquidityStats()` function calls `slot0()` on the Uniswap V3 pool and parses the response as a named object: ```typescript let currentTick: number | null = null; if (isRecord(slot0Response) && typeof slot0Response.tick === 'number') { currentTick = slot0Response.tick; } ``` viem v2 returns multi-output contract calls as **plain arrays**, not named objects. `slot0()` has 7 outputs, so viem returns: ``` [195719044954189908619660483n, -120075, 3, 100, 100, 0, true] // sqrtPriceX96 tick observationIndex ... ``` `isRecord()` passes (arrays are objects in JS), but `slot0Response.tick` is `undefined` because arrays don't have a `.tick` property. So `currentTick` stays `null` and the error is thrown. ## Reproduction 1. Start the harb stack (`docker compose up -d`) 2. Open http://localhost:5173/cheats 3. The Liquidity Snapshot card shows: *Unable to determine current pool tick* 4. Verified via `cast call` that `slot0()` returns valid data (tick = -120075) ## Fix Destructure `slot0Response` as an array (index `[1]` is the tick): ```typescript const slot0Array = slot0Response as readonly [bigint, number, ...unknown[]]; currentTick = Number(slot0Array[1]); ``` Note: the same file already handles both array and record shapes for the `positions()` call via `toPosition()` — a similar pattern should be used here for consistency. ## Files - `web-app/src/views/CheatsView.vue` — `loadLiquidityStats()`, around line 558
johba added the
backlog
label 2026-04-05 16:14:03 +00:00
dev-bot self-assigned this 2026-04-05 16:19:02 +00:00
dev-bot added
in-progress
and removed
backlog
labels 2026-04-05 16:19:03 +00:00
Collaborator

Blocked — issue #2

Field Value
Exit reason no_push
Timestamp 2026-04-05T16:20:05Z
Diagnostic output
Claude did not push branch fix/issue-2
### Blocked — issue #2 | Field | Value | |---|---| | Exit reason | `no_push` | | Timestamp | `2026-04-05T16:20:05Z` | <details><summary>Diagnostic output</summary> ``` Claude did not push branch fix/issue-2 ``` </details>
dev-bot added
blocked
and removed
in-progress
labels 2026-04-05 16:20:06 +00:00
Collaborator

Blocked — issue #2

Field Value
Exit reason no_push
Timestamp 2026-04-05T16:20:09Z
Diagnostic output
Claude did not push branch fix/issue-2
### Blocked — issue #2 | Field | Value | |---|---| | Exit reason | `no_push` | | Timestamp | `2026-04-05T16:20:09Z` | <details><summary>Diagnostic output</summary> ``` Claude did not push branch fix/issue-2 ``` </details>
dev-bot added the
in-progress
label 2026-04-05 16:49:03 +00:00
dev-bot was unassigned by dev-qwen 2026-04-05 16:54:01 +00:00
dev-qwen removed the
in-progress
label 2026-04-05 16:54:02 +00:00
Collaborator

Dev-agent: Already implemented

Existing implementation

Fix already merged into master via PR #3 (commit f1e4c37)

Closing as already implemented.


Automated assessment by dev-agent · 2026-04-05 16:55 UTC

✅ **Dev-agent: Already implemented** ### Existing implementation Fix already merged into master via PR #3 (commit f1e4c37) Closing as already implemented. --- *Automated assessment by dev-agent · 2026-04-05 16:55 UTC*
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: johba/harb#2
No description provided.