Severity: Important (UX + indexer)
After the pull-model refactor, status == Completed covers three distinct realities:
- Finalized; no prizes claimed yet
- Finalized; some prizes claimed
- Finalized; claim window expired
Frontend has to query each WinnerRecord to figure out the payout state.
Options
Option A — derived helper (lightweight):
pub enum PayoutState {
NotFinalized,
Claimable { unclaimed_count: u32, total_unclaimed: i128 },
PartiallyClaimed { unclaimed_count: u32, total_unclaimed: i128, claimed_count: u32 },
FullyClaimed,
Reclaimable { unclaimed_count: u32, total_unclaimed: i128 },
}
pub fn get_payout_state(env: Env, hackathon_id: u64) -> Result<PayoutState, Error>;
Option B — emit HackathonFullyClaimed event when last claim happens: indexer-friendly, no extra storage.
Recommend both: derived query for one-shot UI loads, event for streaming indexers.
Tests
- Each PayoutState branch covered
- Event fires exactly once on transition to FullyClaimed
Severity: Important (UX + indexer)
After the pull-model refactor,
status == Completedcovers three distinct realities:Frontend has to query each
WinnerRecordto figure out the payout state.Options
Option A — derived helper (lightweight):
Option B — emit
HackathonFullyClaimedevent when last claim happens: indexer-friendly, no extra storage.Recommend both: derived query for one-shot UI loads, event for streaming indexers.
Tests