-
Notifications
You must be signed in to change notification settings - Fork 43
Implement FCFS (Single Claim) Bounty Flow #140
Copy link
Copy link
Open
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programcomponentfrontendFrontend developmentFrontend developmenthelp wantedExtra attention is neededExtra attention is needed
Milestone
Description
Feature: Implement FCFS (Single Claim) Bounty Flow
Overview
The documentation describes 4 bounty claiming models, but the frontend only partially implements the Application model. The FCFS (First-Come-First-Served) / Single Claim model — where the first contributor to click "Claim" gets exclusive rights — is completely missing from the UI.
This maps directly to the claim_bounty() and approve_fcfs() methods on the Bounty Registry smart contract.
Depends on: #139 (TypeScript contract bindings)
Goals
- Allow contributors to instantly claim FCFS bounties with one click
- Spend 1 Spark Credit on claim (via Reputation Registry contract)
- Lock bounty to the claiming contributor's wallet
- Show "Already Claimed" state to other users
- Enable bounty creator to approve completed FCFS work
Contract Methods Used
BountyRegistry.claim_bounty(contributor: Address, bounty_id: u64)
→ Spends 1 SparkCredit from Reputation Registry
→ Locks escrow pool and defines release slot
BountyRegistry.approve_fcfs(creator: Address, bounty_id: u64, points: u32)
→ Releases escrow to contributor
→ Awards 1 credit + reputation points
Implementation Details
1. FCFS Claim Button
Modify: app/bounty/[bountyId]/page.tsx
- Show "Claim Bounty" button for FCFS-type bounties with status
Open - On click:
- Check user has ≥1 Spark Credit (read
get_credits()) - Build unsigned
claim_bountytransaction - Prompt passkey signing
- Submit signed transaction
- Optimistically update UI to "Claimed" state
- Check user has ≥1 Spark Credit (read
- Show "Already Claimed by @user" when bounty is
InProgress
2. FCFS Approval Flow
Modify: app/bounty/[bountyId]/page.tsx
- For bounty creator, when bounty is
InReview:- Show submission details
- "Approve & Release Payment" button
- Calls
approve_fcfs(creator, bounty_id, points) - Triggers escrow release
3. Anti-Squatting Display
- Show countdown timer for auto-release (7 days no milestone, 3 days no response)
- Show abandonment warning to claimant
- Creator override: "Unclaim" button with justification
4. Create Hook
Create: hooks/use-claim-bounty.ts
- Wraps
claim_bountycontract call - Handles transaction building, signing, submission
- Invalidates bounty query cache on success
Files Affected
Modified
app/bounty/[bountyId]/page.tsxcomponents/bounty/bounty-card.tsx(show "Claimed" badge)
Created
hooks/use-claim-bounty.tscomponents/bounty/fcfs-claim-button.tsxcomponents/bounty/fcfs-approval-panel.tsx
Acceptance Criteria
- FCFS bounties show "Claim" button for eligible contributors
- Claiming spends 1 Spark Credit and locks bounty
- Other users see "Already Claimed" state
- Creator can approve FCFS work and release payment
- Auto-release timers displayed for anti-squatting
- Optimistic UI updates on claim/approve
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programcomponentfrontendFrontend developmentFrontend developmenthelp wantedExtra attention is neededExtra attention is needed