Background
Contract Issue 6 makes finalize_event permissionless — anyone can call
it once event.has_ended() is true and all of the event's matches have a
result. The backend already holds a server-controlled keypair
(SERVER_SECRET_KEY, validated in `src/config/env.validation.
Goal
Add a scheduled job that finds events past their end_time with all
matches resolved and not yet finalized, and calls finalize_event for each
using the server keypair.
Tasks
- New
SorobanService method finalizeEvent(onChainEventId: number): 151-220), invoking the contract's finalize_event(event_id)` function
- New service
src/matches/creator-event-finalizer.service.ts:
1 — add is_finalized to that index list too if not already) so this
- Register
CreatorEventFinalizerService in MatchesModule (or a new
- Defensive bound: cap the number of
finalize_event calls per cron
Acceptance Criteria
Background
Contract Issue 6 makes
finalize_eventpermissionless — anyone can callit once
event.has_ended()is true and all of the event's matches have aresult. The backend already holds a server-controlled keypair
(
SERVER_SECRET_KEY, validated in `src/config/env.validation.Goal
Add a scheduled job that finds events past their
end_timewith allmatches resolved and not yet finalized, and calls
finalize_eventfor eachusing the server keypair.
Tasks
SorobanServicemethodfinalizeEvent(onChainEventId: number): 151-220), invoking the contract'sfinalize_event(event_id)` functionsrc/matches/creator-event-finalizer.service.ts:1 — add
is_finalizedto that index list too if not already) so thisCreatorEventFinalizerServiceinMatchesModule(or a newfinalize_eventcalls per cronAcceptance Criteria
end_timein the past,is_finalized = false, and allend_timein the past but at least one unresolved matchis_finalized = true) is excluded fromfinalize_eventRPC failure for one event is logged and does notfinalize_eventcalls happen per cron tick