Skip to content

Conversation

@LeonardoVieira1630
Copy link
Member

@LeonardoVieira1630 LeonardoVieira1630 commented Jan 14, 2026

Summary

  • Created a centralized time-series.ts module in apps/indexer/src/lib/ containing reusable time-series utilities
  • Standardized timestamp handling across the codebase to use seconds instead of milliseconds
  • Removed duplicated forward-fill and timeline logic from multiple services
  • Added comprehensive unit tests for all time-series functions

Changes

New Centralized Module (apps/indexer/src/lib/time-series.ts)

  • truncateTimestampToMidnight - Truncate timestamp to midnight UTC
  • forwardFill - Forward-fill sparse data across a timeline (generic, works with any key/value types)
  • createDailyTimeline - Generate daily timestamps between two dates
  • filterWithFallback - Filter data by cutoff with fallback to last value
  • getLastValueBefore - Get last data point before a given date
  • calculateCutoffTimestamp - Calculate cutoff timestamp for N days ago
  • normalizeMapTimestamps - Normalize all map timestamps to midnight

Refactored Services

  • delegation-percentage - Now uses centralized forwardFill and createDailyTimeline
  • treasury.service - Migrated to use time-series utilities
  • nft-price - Migrated to use time-series utilities
  • coingecko - Migrated to use time-series utilities
  • defillama-provider - Now uses filterWithFallback
  • dune-provider - Now uses filterWithFallback

Removed

  • apps/indexer/src/api/services/treasury/forward-fill.ts - Replaced by centralized module
  • Time utility functions from eventHandlers/shared.ts - Moved to time-series.ts

@LeonardoVieira1630 LeonardoVieira1630 self-assigned this Jan 14, 2026
@LeonardoVieira1630 LeonardoVieira1630 added the enhancement Improving an already existing feature label Jan 14, 2026
@vercel
Copy link

vercel bot commented Jan 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
anticapture Ready Ready Preview, Comment Jan 20, 2026 4:22pm
anticapture-storybook Ready Ready Preview, Comment Jan 20, 2026 4:22pm

Request Review

@vercel vercel bot temporarily deployed to Preview – anticapture-storybook January 15, 2026 01:21 Inactive
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@pikonha pikonha merged commit 644148a into dev Jan 20, 2026
3 checks passed
@pikonha pikonha deleted the refactor/centralize_fowardFill_logic branch January 20, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an already existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants