Feature: Implement Competition (Best Submission Wins) Bounty Flow
Overview
The Competition model (Model 3) allows multiple contributors to claim a bounty simultaneously, submit work blindly, and the creator selects the best submission. Only the winner receives payment. This flow is documented but completely unimplemented on the frontend.
Maps to approve_contest_winner() and finalize_contest() on the Bounty Registry contract.
Depends on: #139 (TypeScript contract bindings)
Goals
- Allow multiple contributors to claim competition bounties (up to max limit)
- Blind submission: hide submissions until deadline
- Creator evaluates all submissions after reveal
- Winner selection triggers escrow release
- Optional consolation prizes for runners-up
Contract Methods Used
BountyRegistry.claim_bounty(contributor, bounty_id)
→ Multiple claimants allowed for Contest type
BountyRegistry.submit_work(contributor, bounty_id, work_cid)
→ Each contestant submits independently
BountyRegistry.approve_contest_winner(creator, bounty_id, winner, payout_amount, points)
→ Can be called multiple times for consolation prizes
BountyRegistry.finalize_contest(creator, bounty_id)
→ Closes contest, prevents further approvals
Implementation Details
1. Competition Claim UI
Modify: app/bounty/[bountyId]/page.tsx
- For Contest-type bounties:
- Show "Join Competition" button (not "Claim")
- Display current participant count vs max (
3/5 slots filled)
- Show submission deadline countdown
- List participants (without revealing submissions)
2. Blind Submission Panel
Create: components/bounty/competition-submission.tsx
- Submission form hidden from other participants
- Countdown to deadline
- After deadline: reveal all submissions simultaneously
- Display submissions in anonymous or randomized order (optional)
3. Winner Selection Panel (Creator View)
Create: components/bounty/competition-judging.tsx
- Grid/list of all submissions post-reveal
- Scoring rubric display (if defined)
- "Select as Winner" button per submission with payout amount
- "Award Consolation" for runners-up
- "Finalize Contest" button to close
4. Competition Status Display
- Before deadline: "X submissions received" (count only)
- After deadline: All submissions revealed
- After judging: Winner highlighted, results published
Files Affected
Modified
app/bounty/[bountyId]/page.tsx
components/bounty/bounty-card.tsx (competition badge + slot count)
Created
hooks/use-competition-bounty.ts
components/bounty/competition-submission.tsx
components/bounty/competition-judging.tsx
components/bounty/competition-status.tsx
Acceptance Criteria
Feature: Implement Competition (Best Submission Wins) Bounty Flow
Overview
The Competition model (Model 3) allows multiple contributors to claim a bounty simultaneously, submit work blindly, and the creator selects the best submission. Only the winner receives payment. This flow is documented but completely unimplemented on the frontend.
Maps to
approve_contest_winner()andfinalize_contest()on the Bounty Registry contract.Depends on: #139 (TypeScript contract bindings)
Goals
Contract Methods Used
Implementation Details
1. Competition Claim UI
Modify:
app/bounty/[bountyId]/page.tsx3/5 slots filled)2. Blind Submission Panel
Create:
components/bounty/competition-submission.tsx3. Winner Selection Panel (Creator View)
Create:
components/bounty/competition-judging.tsx4. Competition Status Display
Files Affected
Modified
app/bounty/[bountyId]/page.tsxcomponents/bounty/bounty-card.tsx(competition badge + slot count)Created
hooks/use-competition-bounty.tscomponents/bounty/competition-submission.tsxcomponents/bounty/competition-judging.tsxcomponents/bounty/competition-status.tsxAcceptance Criteria