Skip to content

[Backend] — EventFinalized indexer handler + prize payout tracking #958

@Olowodarey

Description

@Olowodarey

Background

The contract's new finalize_event (contract Issue 6) is permissionless,
ranks participants via the leaderboard, splits prize_pool according to
reward_distribution, and emits an event with the final
leaderboard + per-user payout amounts.

Goal

Index the EventFinalized contract event: mark the CreatorEvent as
finalized, persist the final ranked leaderboard
(CreatorEventLeaderboardEntry, from Issue 4) with payout amounts, and
expose a payouts API so the frontend can show "you won X XLM, claim it".

Tasks

  1. detectEventType() (line 297): add
  2. extractEventData(): new case —
  3. processEventByType() (switch, ~line 480): add
  4. New entity src/matches/entities/creator-event-payout.entity.ts:
  5. Migration: <timestamp>-CreateCreatorEventPayout.ts.
  6. handleEventFinalized(data):
    • Look up the CreatorEvent by on_chain_event_id = data.event_id; warn
    • If event.is_finalized already (idempotency — events can be

Acceptance Criteria

  • detectEventType recognizes EventFinalized topics
  • handleEventFinalized() creates one CreatorEventLeaderboardEntry and
  • Re-processing the same EventFinalized event (idempotency / replay)
  • GET /creator-events/:id/payouts returns all payouts for a finalized
  • GET /creator-events/:id/payouts/:address returns 404 for an address

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions