Skip to content

feat:Implement community bounty boost mechanism#752

Closed
codebestia wants to merge 3 commits intoSolFoundry:mainfrom
codebestia:feat/bounty-boost-mechanism
Closed

feat:Implement community bounty boost mechanism#752
codebestia wants to merge 3 commits intoSolFoundry:mainfrom
codebestia:feat/bounty-boost-mechanism

Conversation

@codebestia
Copy link
Copy Markdown
Contributor

Description

Implements community bounty boosting — allows any contributor to add $FNDRY to an existing bounty's prize pool. Boosted funds go into escrow alongside the original reward and are automatically refunded if the bounty expires without a winner.

Closes #510

Solana Wallet for Payout

Wallet: 4QhseKvBuaCQhdkP248iXoUxohPzVC5m8pE9hAv4nMYw

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • ✅ Test addition/update

Checklist

  • Code is clean and follows the issue spec exactly
  • One PR per bounty (no multiple bounties in one PR)
  • Tests included for new functionality
  • All existing tests pass
  • No console.log or debugging code left behind
  • No hardcoded secrets or API keys

Testing

  • Unit tests added/updated
  • Integration tests added/updated

Backend (pytest)

  • tests/test_boost.py — 35 tests covering:
    • BoostRequest Pydantic validation (min amount, wallet format)
    • boost_service.create_boost — happy path (pending + confirmed), below-minimum, nonexistent bounty, closed/paid/cancelled bounty rejection, Telegram notification
    • boost_service.get_boosts — pagination, total_boosted only aggregates confirmed rows
    • boost_service.get_boost_leaderboard — multi-wallet ranking, same-wallet aggregation, pending/refunded exclusion
    • boost_service.get_boost_summary — correct original + boosted + total math
    • boost_service.refund_bounty_boosts — refund lifecycle, no double-refund, mixed status handling
    • API layer — 201/422/404 responses for POST /{id}/boost, GET /{id}/boosts, GET /{id}/boost-leaderboard

Frontend (vitest)

  • src/__tests__/boost.test.tsx — 27 tests covering:
    • BoostPanel loading skeletons, success state, no-wallet hides form, closed bounty hides form
    • Prize pool summary (original + boosted amounts displayed separately)
    • Boost form — disabled submit when empty, amount input, submit fires POST
    • Leaderboard — medal display (🥇🥈🥉), empty state, abbreviated wallet addresses
    • History — boost list with amounts and statuses, empty state
    • useBoost hook — API fetch, summary calculation, below-minimum guard, submitBoost API call

Additional Notes

What was built

Layer File Purpose
Model backend/app/models/boost.py BountyBoostTable ORM + Pydantic schemas
Migration alembic/versions/005_add_bounty_boosts.py bounty_boosts table (revises 004)
Exceptions backend/app/exceptions.py BoostBelowMinimumError, BoostInvalidBountyError
Service backend/app/services/boost_service.py Full CRUD + Telegram notification + refund logic
API backend/app/api/bounties.py 3 endpoints: POST boost, GET boosts, GET boost-leaderboard
Types frontend/src/types/boost.ts TypeScript types
Hook frontend/src/hooks/useBoost.ts React Query data + submit mutation
Component frontend/src/components/bounties/BoostPanel.tsx Prize summary, boost form, leaderboard, history
Integration frontend/src/components/BountyDetailPage.tsx BoostPanel wired into bounty sidebar

Key design decisions

  • Minimum 1,000 $FNDRY enforced at Pydantic schema level (422 before it hits the service) and in the hook client-side
  • Status flow: PENDINGCONFIRMED (tx hash provided) → REFUNDED (bounty expires/cancels)
  • total_boosted only counts CONFIRMED rows — pending and refunded are excluded from prize pool display and leaderboard
  • Telegram notification is best-effort (fire-and-forget via httpx); configurable via TELEGRAM_BOT_TOKEN + TELEGRAM_CHAT_ID env vars, silently skipped if unset
  • Boost form only renders for open/in_progress bounties with a connected wallet; hidden otherwise
  • refund_bounty_boosts(bounty_id) is the hook for the expiry/cancellation path — can be called from the existing refund_expired_escrows periodic job

@codebestia codebestia closed this Mar 23, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0417e91c-88f9-4b4f-a2e5-34da029305a5

📥 Commits

Reviewing files that changed from the base of the PR and between e8acfd0 and a23c731.

📒 Files selected for processing (4)
  • backend/alembic/versions/005_add_bounty_boosts.py
  • backend/app/models/boost.py
  • backend/app/services/boost_service.py
  • backend/tests/test_boost.py

📝 Walkthrough

Walkthrough

Adds a complete bounty boost feature across backend and frontend. Backend: new Alembic migration creating bounty_boosts, SQLAlchemy model and Pydantic schemas, boost service with create/list/summary/leaderboard/refund functions, new exceptions, and three API endpoints for creating and querying boosts. Database initialization registers the boost model. Frontend: new types, React hook useBoost, BoostPanel UI, and tests. Comprehensive backend and frontend test suites added exercising boost behaviors and API integration.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

changes-requested

Suggested reviewers

  • chronoeth-creator
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat:Implement community bounty boost mechanism' accurately and clearly summarizes the main feature being added.
Description check ✅ Passed The PR description is comprehensive and directly related to the changeset, covering implementation details, testing, and design decisions.
Linked Issues check ✅ Passed All acceptance criteria from issue #510 are met: endpoints POST/GET implemented, bounty display shows original+boosted separately, leaderboard and history provided, minimum 1,000 $FNDRY enforced, refund logic included, Telegram notification implemented, frontend UI complete, and comprehensive tests added.
Out of Scope Changes check ✅ Passed All changes are directly related to the bounty boost feature scope. Only additions to support the boost mechanism and a minor currency formatting update ($FNDRY) which aligns with PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant