# skyu2231/raffle_contract_web3 architecture

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

- Interactive diagram: https://gitdiagram.com/skyu2231/raffle_contract_web3
- Repository: https://github.com/skyu2231/raffle_contract_web3

## Overview

This is a MetaMask-oriented Web3 raffle frontend backed by a Chainlink-enabled lottery contract. Users connect a wallet, inspect live raffle state and activity, then submit paid entries or request a draw; the contract handles eligibility, randomness, and winner selection. The graph emphasizes the entry-to-result workflow while retaining the documented automation and VRF stages and the app’s promotional interface. Contract source is not in the supplied file tree, so its behavior is represented from the README; frontend relationships are limited to shown excerpts and indexed references.

Main entry points: [`frontend/src/App.tsx`](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/App.tsx) (App composition), [`frontend/src/hooks/useRaffle.ts`](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useRaffle.ts) (Raffle state), [`src/Raffle.sol`](https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol) (Random winner), [`frontend/src/hooks/useActivity.ts`](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useActivity.ts) (Activity feed)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web interface"]
  node_app["App composition<br/>[App.tsx]"]
  node_landing["Landing experience<br/>[Hero.tsx]"]
  node_showcase["Feature showcase<br/>[Showcase.tsx]"]
end

subgraph group_frontend["Raffle frontend"]
  node_wallet["Wallet connection<br/>[ConnectWallet.tsx]"]
  node_entryui["Entry interface<br/>[EnterTab.tsx]"]
  node_state["Raffle state<br/>[useRaffle.ts]"]
  node_activity["Activity feed<br/>[useActivity.ts]"]
  node_entryaction["Entry transaction"]
  node_abi["Contract interface<br/>[raffleAbi.ts]"]
  node_config["Chain configuration<br/>[config.ts]"]
end

subgraph group_protocol["Raffle protocol"]
  node_contract["Raffle contract<br/>[Raffle.sol]"]
  node_pool[("Ticket pool<br/>[Raffle.sol]")]
  node_draw["Draw eligibility<br/>[Raffle.sol]"]
  node_randomness["Random winner<br/>[Raffle.sol]"]
end

subgraph group_integrations["Chain services"]
  node_chain[("EVM network")]
  node_automation["Chainlink Automation"]
  node_vrf["Chainlink VRF"]
end

node_visitor(("Raffle visitor"))

node_visitor -->|"uses"| node_app
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_showcase
node_app -.->|"offers connection"| node_wallet
node_app -->|"loads state"| node_state
node_app -->|"loads events"| node_activity
node_visitor -->|"connects wallet"| node_wallet
node_visitor -->|"enters raffle"| node_entryui
node_entryui -->|"submits entries"| node_entryaction
node_entryaction -->|"encodes call"| node_abi
node_entryaction -->|"writes transaction"| node_chain
node_state -->|"reads interface"| node_abi
node_state -->|"resolves address"| node_config
node_state -->|"reads contract"| node_chain
node_activity -->|"queries events"| node_abi
node_activity -->|"reads logs"| node_chain
node_chain -->|"executes calls"| node_contract
node_contract -->|"records entries"| node_pool
node_automation -->|"checks upkeep"| node_draw
node_automation -->|"triggers upkeep"| node_contract
node_draw -->|"requests winner"| node_randomness
node_randomness -->|"requests randomness"| node_vrf
node_vrf -->|"fulfills request"| node_randomness
node_randomness -->|"selects winner"| node_pool

click node_app "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/App.tsx"
click node_landing "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/Hero.tsx"
click node_showcase "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/Showcase.tsx"
click node_wallet "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/ConnectWallet.tsx"
click node_entryui "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/EnterTab.tsx"
click node_state "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useRaffle.ts"
click node_activity "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useActivity.ts"
click node_entryaction "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useRaffleActions.ts"
click node_abi "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/lib/raffleAbi.ts"
click node_config "https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/lib/config.ts"
click node_contract "https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol"
click node_pool "https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol"
click node_draw "https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol"
click node_randomness "https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol"

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_app,node_landing,node_showcase toneBlue
class node_wallet,node_entryui,node_state,node_activity,node_entryaction,node_abi,node_config toneAmber
class node_contract,node_pool,node_draw,node_randomness toneMint
class node_chain,node_automation,node_vrf toneRose
class node_visitor toneIndigo
```

## Components

### Web interface

- [App composition](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Landing experience](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/Hero.tsx): `frontend/src/components/Hero.tsx`
- [Feature showcase](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/Showcase.tsx): `frontend/src/components/Showcase.tsx`

### Raffle frontend

- [Wallet connection](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/ConnectWallet.tsx): `frontend/src/components/ConnectWallet.tsx`
- [Entry interface](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/components/EnterTab.tsx): `frontend/src/components/EnterTab.tsx`
- [Raffle state](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useRaffle.ts): `frontend/src/hooks/useRaffle.ts`
- [Activity feed](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useActivity.ts): `frontend/src/hooks/useActivity.ts`
- [Entry transaction](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/hooks/useRaffleActions.ts): `frontend/src/hooks/useRaffleActions.ts`
- [Contract interface](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/lib/raffleAbi.ts): `frontend/src/lib/raffleAbi.ts`
- [Chain configuration](https://github.com/skyu2231/raffle_contract_web3/blob/main/frontend/src/lib/config.ts): `frontend/src/lib/config.ts`

### Raffle protocol

- [Raffle contract](https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol): `src/Raffle.sol`
- [Ticket pool](https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol): `src/Raffle.sol`
- [Draw eligibility](https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol): `src/Raffle.sol`
- [Random winner](https://github.com/skyu2231/raffle_contract_web3/blob/main/src/Raffle.sol): `src/Raffle.sol`

### Chain services

- **EVM network**
- **Chainlink Automation**
- **Chainlink VRF**

### Other components

- **Raffle visitor**

## Connections

- Raffle visitor → App composition: uses (evidence: `README.md`)
- App composition → Landing experience: renders (evidence: `frontend/src/App.tsx`)
- App composition → Feature showcase: renders (evidence: `frontend/src/App.tsx`)
- App composition → Wallet connection: offers connection
- App composition → Raffle state: loads state (evidence: `frontend/src/App.tsx`)
- App composition → Activity feed: loads events (evidence: `frontend/src/App.tsx`)
- Raffle visitor → Wallet connection: connects wallet (evidence: `README.md`)
- Raffle visitor → Entry interface: enters raffle (evidence: `README.md`)
- Entry interface → Entry transaction: submits entries (evidence: `frontend/src/hooks/useRaffleActions.ts`)
- Entry transaction → Contract interface: encodes call (evidence: `frontend/src/hooks/useRaffleActions.ts`)
- Entry transaction → EVM network: writes transaction (evidence: `README.md`)
- Raffle state → Contract interface: reads interface (evidence: `frontend/src/hooks/useRaffle.ts`)
- Raffle state → Chain configuration: resolves address (evidence: `frontend/src/hooks/useRaffle.ts`)
- Raffle state → EVM network: reads contract (evidence: `frontend/src/hooks/useRaffle.ts`)
- Activity feed → Contract interface: queries events (evidence: `frontend/src/hooks/useActivity.ts`)
- Activity feed → EVM network: reads logs (evidence: `frontend/src/hooks/useActivity.ts`)
- EVM network → Raffle contract: executes calls (evidence: `README.md`)
- Raffle contract → Ticket pool: records entries (evidence: `README.md`)
- Chainlink Automation → Draw eligibility: checks upkeep (evidence: `README.md`)
- Chainlink Automation → Raffle contract: triggers upkeep (evidence: `README.md`)
- Draw eligibility → Random winner: requests winner (evidence: `README.md`)
- Random winner → Chainlink VRF: requests randomness (evidence: `README.md`)
- Chainlink VRF → Random winner: fulfills request (evidence: `README.md`)
- Random winner → Ticket pool: selects winner (evidence: `README.md`)
