# quantumchain-core/sunny-pad architecture

> Architecture diagram of the GitHub repository quantumchain-core/sunny-pad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quantumchain-core/sunny-pad
- Repository: https://github.com/quantumchain-core/sunny-pad

## Overview

Sunny Pad is a Solana token launchpad: users are meant to launch tokens and trade them on an Anchor bonding curve, with launch and trading fees distributed on-chain. The sampled web page is informational, while the Rust program implements launch and buy/sell handlers and bonding-curve state. The README also documents token safety, graduation, bundle checks, IPFS, and a Supabase cache; their implementation and wiring are not shown, so those links are documented rather than verified. No sampled frontend code connects wallets or invokes the program.

Main entry points: [`program/programs/sunny-pad/src/lib.rs`](https://github.com/quantumchain-core/sunny-pad/blob/main/program/programs/sunny-pad/src/lib.rs) (Anchor handlers), [`app/src/app/page.tsx`](https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/app/page.tsx) (Home page), [`app/src/lib/sunnypad.ts`](https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/lib/sunnypad.ts) (Fee calculator), [`program/programs/sunny-pad`](https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad) (IPFS metadata)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web App"]
  node_webpage["Home page<br/>[page.tsx]"]
  node_feehelper["Fee calculator<br/>[sunnypad.ts]"]
  node_config["App constants<br/>[constants.ts]"]
end

subgraph group_chain["On-Chain Program"]
  node_program["Anchor handlers<br/>[lib.rs]"]
  node_curve[("Curve state<br/>[bonding_curve.rs]")]
  node_vaultstate[("Vault state<br/>[vault.rs]")]
end

subgraph group_launch["Launch Features"]
  node_safety["Token safeguards"]
  node_graduation["Raydium graduation"]
  node_bundle["Bundle check"]
  node_metadata["IPFS metadata"]
end

subgraph group_integrations["External Services"]
  node_pinata{{"Pinata"}}
  node_cache[("Supabase cache")]
end

node_visitor(("Launchpad user"))
node_treasury(("Treasury wallet"))
node_creator(("Creator wallet"))
node_competition[("Competition vault")]
node_solana{{"Solana network"}}

node_visitor -->|"views"| node_webpage
node_webpage -.->|"fee display"| node_feehelper
node_feehelper -->|"reads fees"| node_config
node_visitor -.->|"launches or trades"| node_program
node_program -->|"updates reserves"| node_curve
node_program -->|"initializes vault"| node_vaultstate
node_program -->|"transfers fees"| node_treasury
node_program -->|"pays trade fee"| node_creator
node_program -->|"routes SUNNY fee"| node_competition
node_program -->|"executes on"| node_solana
node_program -.->|"supports"| node_safety
node_program -.->|"graduates at threshold"| node_graduation
node_program -.->|"checks bundles"| node_bundle
node_program -.->|"uses metadata URI"| node_metadata
node_metadata -.->|"stores on"| node_pinata
node_program -.->|"uses cache"| node_cache

click node_webpage "https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/app/page.tsx"
click node_feehelper "https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/lib/sunnypad.ts"
click node_config "https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/lib/constants.ts"
click node_program "https://github.com/quantumchain-core/sunny-pad/blob/main/program/programs/sunny-pad/src/lib.rs"
click node_curve "https://github.com/quantumchain-core/sunny-pad/blob/main/program/programs/sunny-pad/src/state/bonding_curve.rs"
click node_vaultstate "https://github.com/quantumchain-core/sunny-pad/blob/main/program/programs/sunny-pad/src/state/vault.rs"
click node_safety "https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad"
click node_graduation "https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad"
click node_bundle "https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad"
click node_metadata "https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad"
click node_cache "https://github.com/quantumchain-core/sunny-pad/tree/main/supabase"

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_webpage,node_feehelper,node_config,node_visitor toneBlue
class node_program,node_curve,node_vaultstate,node_competition toneAmber
class node_safety,node_graduation,node_bundle,node_metadata toneMint
class node_pinata,node_cache toneRose
class node_treasury,node_creator,node_solana toneIndigo
```

## Components

### Web App

- [Home page](https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/app/page.tsx): `app/src/app/page.tsx`
- [Fee calculator](https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/lib/sunnypad.ts): `app/src/lib/sunnypad.ts`
- [App constants](https://github.com/quantumchain-core/sunny-pad/blob/main/app/src/lib/constants.ts): `app/src/lib/constants.ts`

### On-Chain Program

- [Anchor handlers](https://github.com/quantumchain-core/sunny-pad/blob/main/program/programs/sunny-pad/src/lib.rs): `program/programs/sunny-pad/src/lib.rs`
- [Curve state](https://github.com/quantumchain-core/sunny-pad/blob/main/program/programs/sunny-pad/src/state/bonding_curve.rs): `program/programs/sunny-pad/src/state/bonding_curve.rs`
- [Vault state](https://github.com/quantumchain-core/sunny-pad/blob/main/program/programs/sunny-pad/src/state/vault.rs): `program/programs/sunny-pad/src/state/vault.rs`

### Launch Features

- [Token safeguards](https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad): `program/programs/sunny-pad`
- [Raydium graduation](https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad): `program/programs/sunny-pad`
- [Bundle check](https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad): `program/programs/sunny-pad`
- [IPFS metadata](https://github.com/quantumchain-core/sunny-pad/tree/main/program/programs/sunny-pad): `program/programs/sunny-pad`

### External Services

- **Pinata**
- [Supabase cache](https://github.com/quantumchain-core/sunny-pad/tree/main/supabase): `supabase`

### Other components

- **Launchpad user**
- **Treasury wallet**
- **Creator wallet**
- **Competition vault**
- **Solana network**

## Connections

- Launchpad user → Home page: views (evidence: `app/src/app/page.tsx`)
- Home page → Fee calculator: fee display
- Fee calculator → App constants: reads fees (evidence: `app/src/lib/sunnypad.ts`)
- Launchpad user → Anchor handlers: launches or trades (evidence: `README.md`)
- Anchor handlers → Curve state: updates reserves (evidence: `program/programs/sunny-pad/src/lib.rs`)
- Anchor handlers → Vault state: initializes vault (evidence: `program/programs/sunny-pad/src/lib.rs`)
- Anchor handlers → Treasury wallet: transfers fees (evidence: `program/programs/sunny-pad/src/lib.rs`)
- Anchor handlers → Creator wallet: pays trade fee (evidence: `program/programs/sunny-pad/src/lib.rs`)
- Anchor handlers → Competition vault: routes SUNNY fee (evidence: `program/programs/sunny-pad/src/lib.rs`)
- Anchor handlers → Solana network: executes on (evidence: `README.md`)
- Anchor handlers → Token safeguards: supports (evidence: `README.md`)
- Anchor handlers → Raydium graduation: graduates at threshold (evidence: `README.md`)
- Anchor handlers → Bundle check: checks bundles (evidence: `README.md`)
- Anchor handlers → IPFS metadata: uses metadata URI (evidence: `README.md`)
- IPFS metadata → Pinata: stores on (evidence: `README.md`)
- Anchor handlers → Supabase cache: uses cache (evidence: `README.md`)
