fix: protocol activity statistics stay zero — ponder watches wrong contract addresses #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
On the app page, protocol activity statistics stay zero on all parameters (except holder count) even after trades and staking.
Reported in codeberg#1193.
Root cause (three issues)
1. Missing
LM_ADDRESSin ponder's.env.localcontainers/bootstrap.shwrite_ponder_env()writesKRAIKEN_ADDRESSandSTAKE_ADDRESSbut does not writeLM_ADDRESS. Without it, ponder falls back to a hardcoded default inponder.config.tsthat has no code deployed on this Anvil fork. The actual LiquidityManager is at a different address.Result: 5 LiquidityManager events on chain (Recentered, EthScarcity/EthAbundance) are completely missed. This causes:
lastRecenterTimestamp=0,recentersLastDay=0,lastEthReserve=0.2. Missing
POOL_ADDRESSin ponder's environmentPOOL_ADDRESSis hardcoded inservices/ponder/src/kraiken.tsandstake.tsas a Base Sepolia address. On local Anvil, the pool is at a different address. This means:isBuy = from.toLowerCase() === POOL_ADDRESS) never matchesupdateEthReserve()reads WETH balance of a non-existent pool (returns 0)3. Ring buffer never populated for early events
The initial Transfer events happen within 13 blocks of deployment.
checkBlockHistorySufficient()requires 100 blocks since deployment before populating the ring buffer. All initial events hit the early-return path that updatestotalMinted/totalBurnedbut skips the ring buffer, so rolling window stats (mintedLastDay,mintedLastWeek, etc.) compute to zero.Why holder count works
holderCountis tracked directly in theKraiken:Transferhandler — it increments/decrements when balances change from/to zero. It does NOT depend on the ring buffer, pool address, or LM address.Fix
containers/bootstrap.shwrite_ponder_env()must includeLM_ADDRESSandPOOL_ADDRESSfrom the deployed contract addressesservices/ponder/src/kraiken.tsandstake.tsshould readPOOL_ADDRESSfrom env instead of hardcoding itReproduction
Files
containers/bootstrap.sh—write_ponder_env()missing LM_ADDRESS and POOL_ADDRESSservices/ponder/src/kraiken.ts— hardcoded POOL_ADDRESSservices/ponder/src/stake.ts— hardcoded POOL_ADDRESSservices/ponder/ponder.config.ts— LM_ADDRESS fallback defaultservices/ponder/src/helpers/ringBuffer.ts—checkBlockHistorySufficient()100-block thresholdBlocked — issue #4
closed_externally2026-04-05T17:31:56ZBlocked — issue #4
closed_externally2026-04-05T17:38:16Z