fix: fix: protocol activity statistics stay zero — ponder watches wrong contract addresses (#4)

1. Add LM_ADDRESS and POOL_ADDRESS to ponder .env.local (bootstrap.sh)
2. Discover pool address from Uniswap factory during bootstrap (bootstrap-common.sh)
3. Make ring buffer block threshold configurable via MINIMUM_BLOCKS_FOR_RINGBUFFER env var,
   set to 0 for local dev so early events populate the ring buffer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
johba 2026-04-05 17:21:41 +00:00
parent 41a3d52319
commit e20b4517fd
3 changed files with 16 additions and 1 deletions

View file

@ -102,6 +102,18 @@ extract_addresses() {
bootstrap_log "LiquidityManager address missing"
exit 1
fi
# Discover Uniswap pool address from factory
detect_swap_router
local factory
factory=$(cast call --rpc-url "$ANVIL_RPC" "$SWAP_ROUTER" "factory()(address)" 2>/dev/null) || factory=""
if [[ -n "$factory" && "$factory" != "0x" ]]; then
POOL_ADDRESS=$(cast call --rpc-url "$ANVIL_RPC" "$factory" "getPool(address,address,uint24)(address)" "$WETH" "$KRAIKEN" 10000 2>/dev/null) || POOL_ADDRESS=""
fi
if [[ -z "$POOL_ADDRESS" || "$POOL_ADDRESS" == "0x0000000000000000000000000000000000000000" ]]; then
bootstrap_log "Warning: could not discover pool address"
POOL_ADDRESS=""
fi
}
write_contracts_env() {