Skip to content

feat(snapshotters): add supply snapshotter (monthly total-supply samples) - #16

Closed
nimrod-teich wants to merge 0 commit into
feat/provider-rewards-snapshotterfrom
feat/supply-snapshotter
Closed

nimrod-teich wants to merge 0 commit into
feat/provider-rewards-snapshotterfrom
feat/supply-snapshotter

Conversation

@nimrod-teich

Copy link
Copy Markdown
Contributor

Summary

Third sibling snapshotter alongside provider_rewards and denom_prices. Captures Lava's total ulava supply at each genesis-anchored monthly-17th slot; downstream consumers (info's /burn-rate) read app.supply_snapshots via GraphQL and compute monthly burn locally.

Stacked on #15 — base is `feat/provider-rewards-snapshotter`. Will rebase onto main after #15 merges.

What it does

  • New table app.supply_snapshots (snapshot_date PK, block_height, block_time, snapshot_at, total_supply NUMERIC(40,0), status, error).
  • One REST call per snapshot: `/cosmos/bank/v1beta1/supply?pagination.limit=10000` pinned via `x-cosmos-block-height`, `lava-extension: archive`. Extract `ulava`, persist.
  • Missing `ulava` → `status='failed'` with error (not silent zero).
  • Same genesis-anchored monthly cadence as the other snapshotters (reuses `provider_rewards.ExpectedDates` + `snapshotters.FindBlockAtTime`).
  • No UI changes — dashboard iterates `Snapshotters.All()` generically.

Config

```yaml
snapshotters:
handlers: ["all"]
supply:
rest_url: "" # optional; inherits main REST endpoint
rest_headers: {} # e.g. lava-extension: archive
earliest_date: "" # optional floor; empty = from genesis
```

Env: `SUPPLY_REST_URL`.

Test plan

  • `go build ./...` clean
  • `go vet ./...` clean
  • `go test ./...` green — 13 new tests for the supply snapshotter
  • Deployed & populated on mainnet after the parent PR merges

Consumer

Follow-up commit on info PR #44 rewrites `/burn-rate` to query `allSupplySnapshots` — it degrades gracefully (returns `blocks: []`) until this indexer PR ships and the table is populated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant