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
detectEventType() (line 297): add
extractEventData(): new case —
processEventByType() (switch, ~line 480): add
- New entity
src/matches/entities/creator-event-payout.entity.ts:
- Migration:
<timestamp>-CreateCreatorEventPayout.ts.
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
Background
The contract's new
finalize_event(contract Issue 6) is permissionless,ranks participants via the leaderboard, splits
prize_poolaccording toreward_distribution, and emits an event with the finalleaderboard + per-user payout amounts.
Goal
Index the
EventFinalizedcontract event: mark theCreatorEventasfinalized, persist the final ranked leaderboard
(
CreatorEventLeaderboardEntry, from Issue 4) with payout amounts, andexpose a payouts API so the frontend can show "you won X XLM, claim it".
Tasks
detectEventType()(line 297): addextractEventData(): new case —processEventByType()(switch, ~line 480): addsrc/matches/entities/creator-event-payout.entity.ts:<timestamp>-CreateCreatorEventPayout.ts.handleEventFinalized(data):CreatorEventbyon_chain_event_id = data.event_id; warnevent.is_finalizedalready (idempotency — events can beAcceptance Criteria
detectEventTyperecognizesEventFinalizedtopicshandleEventFinalized()creates oneCreatorEventLeaderboardEntryandEventFinalizedevent (idempotency / replay)GET /creator-events/:id/payoutsreturns all payouts for a finalizedGET /creator-events/:id/payouts/:addressreturns 404 for an address