The Graph Integration

Leet Lotto has partnered with The Graph protocol to introduce a decentralized indexing solution for our platform.

Visit The Graph

Every ticket, draw and prize moves through a dedicated subgraph for fast, queryable data.

Data Flow

  1. Smart Contracts emit events (TicketBought, WinnerDeclared).

  2. Subgraph Mapping ingests events and writes to indexed entities.

  3. Frontend uses @tanstack/react-query to hit the GraphQL endpoint and cache results.

// âš ī¸ Simplified example
export const useActiveLottos = () =>
  useQuery({
    queryKey: ["lottos", "active"],
    queryFn: getActiveLottos() // Graph query function
    refetchInterval: 30000, // 30 s
  });

Benefits

  • <30 s dashboard refresh

  • Zero over-fetching – only pull the fields you need

  • Seamless optimistic updates on ticket purchase

Last updated