livepeer / livepeer/subgraph

Centralize day/timestamp helper utilities

Open
#178 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5
Forks
7
Avg merge
4h 1m
Merged PRs (30d)
6

Description

We compute day IDs and start-of-day timestamps in multiple mappings (e.g., BroadcasterDay, TranscoderDay, createOrLoadDay, and TicketBroker handlers). It would be good to centralize this logic in helpers.ts (e.g., dayStart(timestamp) and dayId(timestamp)) and reuse those helpers across mappings.

Goal: ensure day-boundary math is consistent across all handlers, reduce duplicated logic, and make future changes easier and safer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in utils/helpers.ts at the existing day-ID and start-of-day logic referenced for BroadcasterDay, TranscoderDay, and createOrLoadDay, then compare the duplicate calculation in src/mappings/ticketBroker.ts. Centralize the day-boundary helpers and update all listed handlers to reuse them. Done means the mappings use consistent day IDs and start-of-day timestamps.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.