# rishi2600/openbounty-v2 architecture

> Architecture diagram of the GitHub repository rishi2600/openbounty-v2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rishi2600/openbounty-v2
- Repository: https://github.com/rishi2600/openbounty-v2

## Overview

OpenBounty is a Solana bounty application: organizers create funded, tiered bounties; judges vote for winners; winners claim prizes and organizers can reclaim unclaimed prizes after the deadline. The frontend also supports bounty discovery, role-specific task views, market/news information, and submission/judging screens. The principal create-and-settle flow is represented alongside those documented UI capabilities. Sampled hooks and program entry points ground the transaction and read edges; several unsampled page/component connections are omitted where wiring is uncertain.

Main entry points: [`onchain/programs/openbounty_v2/src/lib.rs`](https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/lib.rs) (Program instructions), [`offchain/src/components/me/MyBounties.tsx`](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/me/MyBounties.tsx) (Role tasks), [`offchain/src/hooks/useAllEscrows.ts`](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useAllEscrows.ts) (Escrow listing), [`offchain/src/hooks/useEscrow.ts`](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useEscrow.ts) (Escrow lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Frontend experience"]
  node_layout["App shell<br/>[layout.tsx]"]
  node_create_page["Create page<br/>[page.tsx]"]
  node_create_form["Bounty form"]
  node_detail_page["Bounty detail<br/>[page.tsx]"]
  node_detail_view["Detail panels<br/>[BountyDetail.tsx]"]
  node_explore["Bounty discovery"]
  node_markets_page["Markets<br/>[page.tsx]"]
  node_markets_view["Market charts<br/>[MarketsView.tsx]"]
  node_me_page["My bounties<br/>[page.tsx]"]
  node_me_view["Role tasks<br/>[MyBounties.tsx]"]
  node_judging["Judging board<br/>[JudgingBoard.tsx]"]
  node_submissions["Entries gallery"]
  node_news["News feed<br/>[NewsFeed.tsx]"]
end

subgraph group_client["Client data and actions"]
  node_wallet["Wallet context<br/>[WalletProvider.tsx]"]
  node_create_action["Create transaction<br/>[useCreateBounty.ts]"]
  node_bounty_action["Vote claim refund"]
  node_all_escrows["Escrow listing<br/>[useAllEscrows.ts]"]
  node_one_escrow["Escrow lookup<br/>[useEscrow.ts]"]
  node_viewer_tasks["Task classification<br/>[tasks.ts]"]
  node_market_data["Market queries<br/>[useMarketQuotes.ts]"]
  node_submission_data["Entry handling<br/>[useSubmissions.ts]"]
  node_program_client["Anchor client<br/>[useProgram.ts]"]
end

subgraph group_contract["Solana program"]
  node_escrow_state[("Escrow account<br/>[escrow.rs]")]
  node_program_entry["Program instructions<br/>[lib.rs]"]
  node_initialize["Initialize escrow<br/>[initialize.rs]"]
  node_vote["Finalize winner<br/>[vote.rs]"]
  node_claim["Prize claim<br/>[claim.rs]"]
  node_refund["Unclaimed refund<br/>[refund.rs]"]
end

subgraph group_preview["Preview integrations"]
  node_mock_store[("Mock bounty data<br/>[store.ts]")]
  node_mock_entries["Mock entries<br/>[actions.ts]"]
  node_news_data["News data<br/>[news.ts]"]
end

node_visitor(("Bounty user"))
node_solana[("Solana network")]
node_market_service["Market data source"]

node_visitor -->|"uses app"| node_layout
node_layout -->|"provides wallet"| node_wallet
node_visitor -->|"opens create"| node_create_page
node_create_page -->|"renders form"| node_create_form
node_create_form -->|"submits values"| node_create_action
node_create_action -->|"gets client"| node_program_client
node_create_action -->|"sends initialize"| node_solana
node_solana -->|"dispatches instruction"| node_program_entry
node_program_entry -->|"calls initialize"| node_initialize
node_initialize -->|"creates escrow"| node_escrow_state
node_visitor -->|"opens bounty"| node_detail_page
node_detail_page -->|"renders details"| node_detail_view
node_detail_page -->|"loads address"| node_one_escrow
node_one_escrow -->|"gets client"| node_program_client
node_one_escrow -->|"fetches account"| node_solana
node_solana -->|"returns escrow"| node_one_escrow
node_detail_view -->|"requests action"| node_bounty_action
node_bounty_action -->|"sends vote claim refund"| node_solana
node_solana -->|"dispatches instruction"| node_program_entry
node_program_entry -->|"calls vote"| node_vote
node_program_entry -->|"calls claim"| node_claim
node_program_entry -->|"calls refund"| node_refund
node_vote -->|"updates votes"| node_escrow_state
node_claim -->|"marks claimed"| node_escrow_state
node_refund -->|"updates escrow"| node_escrow_state
node_visitor -->|"browses bounties"| node_explore
node_explore -->|"loads listings"| node_all_escrows
node_all_escrows -->|"reads accounts"| node_solana
node_all_escrows -.->|"loads previews"| node_mock_store
node_visitor -->|"opens tasks"| node_me_page
node_me_page -->|"renders tasks"| node_me_view
node_me_view -->|"loads bounties"| node_all_escrows
node_me_view -->|"classifies roles"| node_viewer_tasks
node_viewer_tasks -->|"returns task groups"| node_me_view
node_visitor -->|"opens markets"| node_markets_page
node_markets_page -->|"renders charts"| node_markets_view
node_markets_view -->|"requests quotes"| node_market_data
node_market_data -.->|"fetches market data"| node_market_service
node_judging -->|"casts vote"| node_bounty_action
node_detail_view -->|"shows entries"| node_submissions
node_submissions -->|"loads and submits"| node_submission_data
node_submission_data -.->|"uses preview actions"| node_mock_entries
node_submission_data -.->|"reads preview entries"| node_mock_store
node_news -.->|"reads feed"| node_news_data

click node_layout "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/layout.tsx"
click node_create_page "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/create/page.tsx"
click node_create_form "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/create/CreateBountyForm.tsx"
click node_detail_page "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/bounty/%5Baddress%5D/page.tsx"
click node_detail_view "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/bounty/BountyDetail.tsx"
click node_explore "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/explore/ExploreBounties.tsx"
click node_markets_page "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/markets/page.tsx"
click node_markets_view "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/markets/MarketsView.tsx"
click node_me_page "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/me/page.tsx"
click node_me_view "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/me/MyBounties.tsx"
click node_judging "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/judging/JudgingBoard.tsx"
click node_submissions "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/submissions/SubmissionGallery.tsx"
click node_news "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/news/NewsFeed.tsx"
click node_wallet "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/WalletProvider.tsx"
click node_create_action "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useCreateBounty.ts"
click node_bounty_action "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useBountyActions.ts"
click node_all_escrows "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useAllEscrows.ts"
click node_one_escrow "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useEscrow.ts"
click node_viewer_tasks "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/utils/tasks.ts"
click node_market_data "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useMarketQuotes.ts"
click node_submission_data "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useSubmissions.ts"
click node_program_client "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useProgram.ts"
click node_escrow_state "https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/state/escrow.rs"
click node_program_entry "https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/lib.rs"
click node_initialize "https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/initialize.rs"
click node_vote "https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/vote.rs"
click node_claim "https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/claim.rs"
click node_refund "https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/refund.rs"
click node_mock_store "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/mocks/store.ts"
click node_mock_entries "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/mocks/actions.ts"
click node_news_data "https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/mocks/news.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_layout,node_create_page,node_create_form,node_detail_page,node_detail_view,node_explore,node_markets_page,node_markets_view,node_me_page,node_me_view,node_judging,node_submissions,node_news,node_visitor toneBlue
class node_wallet,node_create_action,node_bounty_action,node_all_escrows,node_one_escrow,node_viewer_tasks,node_market_data,node_submission_data,node_program_client,node_solana toneAmber
class node_escrow_state,node_program_entry,node_initialize,node_vote,node_claim,node_refund toneMint
class node_mock_store,node_mock_entries,node_news_data toneRose
class node_market_service toneIndigo
```

## Components

### Frontend experience

- [App shell](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/layout.tsx): `offchain/app/layout.tsx`
- [Create page](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/create/page.tsx): `offchain/app/create/page.tsx`
- [Bounty form](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/create/CreateBountyForm.tsx): `offchain/src/components/create/CreateBountyForm.tsx`
- [Bounty detail](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/bounty/%5Baddress%5D/page.tsx): `offchain/app/bounty/[address]/page.tsx`
- [Detail panels](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/bounty/BountyDetail.tsx): `offchain/src/components/bounty/BountyDetail.tsx`
- [Bounty discovery](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/explore/ExploreBounties.tsx): `offchain/src/components/explore/ExploreBounties.tsx`
- [Markets](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/markets/page.tsx): `offchain/app/markets/page.tsx`
- [Market charts](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/markets/MarketsView.tsx): `offchain/src/components/markets/MarketsView.tsx`
- [My bounties](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/app/me/page.tsx): `offchain/app/me/page.tsx`
- [Role tasks](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/me/MyBounties.tsx): `offchain/src/components/me/MyBounties.tsx`
- [Judging board](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/judging/JudgingBoard.tsx): `offchain/src/components/judging/JudgingBoard.tsx`
- [Entries gallery](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/submissions/SubmissionGallery.tsx): `offchain/src/components/submissions/SubmissionGallery.tsx`
- [News feed](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/news/NewsFeed.tsx): `offchain/src/components/news/NewsFeed.tsx`

### Client data and actions

- [Wallet context](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/components/WalletProvider.tsx): `offchain/src/components/WalletProvider.tsx`
- [Create transaction](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useCreateBounty.ts): `offchain/src/hooks/useCreateBounty.ts`
- [Vote claim refund](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useBountyActions.ts): `offchain/src/hooks/useBountyActions.ts`
- [Escrow listing](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useAllEscrows.ts): `offchain/src/hooks/useAllEscrows.ts`
- [Escrow lookup](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useEscrow.ts): `offchain/src/hooks/useEscrow.ts`
- [Task classification](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/utils/tasks.ts): `offchain/src/utils/tasks.ts`
- [Market queries](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useMarketQuotes.ts): `offchain/src/hooks/useMarketQuotes.ts`
- [Entry handling](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useSubmissions.ts): `offchain/src/hooks/useSubmissions.ts`
- [Anchor client](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/hooks/useProgram.ts): `offchain/src/hooks/useProgram.ts`

### Solana program

- [Escrow account](https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/state/escrow.rs): `onchain/programs/openbounty_v2/src/state/escrow.rs`
- [Program instructions](https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/lib.rs): `onchain/programs/openbounty_v2/src/lib.rs`
- [Initialize escrow](https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/initialize.rs): `onchain/programs/openbounty_v2/src/instructions/initialize.rs`
- [Finalize winner](https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/vote.rs): `onchain/programs/openbounty_v2/src/instructions/vote.rs`
- [Prize claim](https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/claim.rs): `onchain/programs/openbounty_v2/src/instructions/claim.rs`
- [Unclaimed refund](https://github.com/rishi2600/openbounty-v2/blob/main/onchain/programs/openbounty_v2/src/instructions/refund.rs): `onchain/programs/openbounty_v2/src/instructions/refund.rs`

### Preview integrations

- [Mock bounty data](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/mocks/store.ts): `offchain/src/mocks/store.ts`
- [Mock entries](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/mocks/actions.ts): `offchain/src/mocks/actions.ts`
- [News data](https://github.com/rishi2600/openbounty-v2/blob/main/offchain/src/mocks/news.ts): `offchain/src/mocks/news.ts`

### Other components

- **Bounty user**
- **Solana network**
- **Market data source**

## Connections

- Bounty user → App shell: uses app
- App shell → Wallet context: provides wallet
- Bounty user → Create page: opens create
- Create page → Bounty form: renders form
- Bounty form → Create transaction: submits values
- Create transaction → Anchor client: gets client
- Create transaction → Solana network: sends initialize
- Solana network → Program instructions: dispatches instruction
- Program instructions → Initialize escrow: calls initialize
- Initialize escrow → Escrow account: creates escrow
- Bounty user → Bounty detail: opens bounty
- Bounty detail → Detail panels: renders details
- Bounty detail → Escrow lookup: loads address
- Escrow lookup → Anchor client: gets client
- Escrow lookup → Solana network: fetches account
- Solana network → Escrow lookup: returns escrow
- Detail panels → Vote claim refund: requests action
- Vote claim refund → Solana network: sends vote claim refund
- Solana network → Program instructions: dispatches instruction
- Program instructions → Finalize winner: calls vote
- Program instructions → Prize claim: calls claim
- Program instructions → Unclaimed refund: calls refund
- Finalize winner → Escrow account: updates votes
- Prize claim → Escrow account: marks claimed
- Unclaimed refund → Escrow account: updates escrow
- Bounty user → Bounty discovery: browses bounties
- Bounty discovery → Escrow listing: loads listings
- Escrow listing → Solana network: reads accounts
- Escrow listing → Mock bounty data: loads previews
- Bounty user → My bounties: opens tasks
- My bounties → Role tasks: renders tasks
- Role tasks → Escrow listing: loads bounties
- Role tasks → Task classification: classifies roles
- Task classification → Role tasks: returns task groups
- Bounty user → Markets: opens markets
- Markets → Market charts: renders charts
- Market charts → Market queries: requests quotes
- Market queries → Market data source: fetches market data
- Judging board → Vote claim refund: casts vote
- Detail panels → Entries gallery: shows entries
- Entries gallery → Entry handling: loads and submits
- Entry handling → Mock entries: uses preview actions
- Entry handling → Mock bounty data: reads preview entries
- News feed → News data: reads feed
