# el-tumero/graviola architecture

> Architecture diagram of the GitHub repository el-tumero/graviola, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/el-tumero/graviola
- Repository: https://github.com/el-tumero/graviola

## Overview

##### Main Components

a) Frontend Layer:
- React-based web application (indicated by the frontend/src structure)
- Redux state management (frontend/src/redux)
- Key features: NFT generation, voting system, keywords management
- Web3 integration components (frontend/src/web3.ts)

b) Smart Contract Layer:
- GraviolaCollection Contract
- GraviolaGenerator Contract
- GraviolaSeasonsArchive Contract
- Governance system (contracts/src/Graviola/seasons/governor)

c) External Services:
- ORA.io Integration (OAO for generation proofs)
- Stable Diffusion API
- IPFS for NFT storage
- Arbitrum One Sepolia network

**[User Interface Layer]**
- ↕
**[Smart Contract Layer]**
- ↕
**[External Services Layer]**

##### Component Relationships

- User interactions with the frontend
- Frontend interactions with smart contracts
- Smart contract interactions with external services
- Data flow for NFT generation and storage

##### Detailed Components

Frontend Section:
- Main pages (Generate, Voting, Keywords, etc.)
- Redux store
- Web3 connection handler
- Component hierarchy

Smart Contract Section:
- Contract interactions
- Governance system
- Archive system
- Generator logic

External Services Section:
- ORA.io integration
- IPFS storage
- Blockchain network

##### Technical Details

- Arbitrum One Sepolia testnet integration
- Smart contract addresses
- Key interfaces between components
- State management flow
- Authentication points

Remember to emphasize the unique aspects of Graviola, such as:
- The on-chain Stable Diffusion integration
- Proof of generation system through ORA
- The seasonal governance structure
- The keyword management system

This will create a comprehensive yet understandable representation of the Graviola system architecture that can be used for both development reference and system understanding.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph User["User Interface"]
        UI_APP["Web Application"]:::frontend
        UI_GEN["NFT Generation Page"]:::frontend
        UI_VOTE["Voting Page"]:::frontend
        UI_KEY["Keywords Page"]:::frontend
        UI_WALLET["Wallet Connection"]:::frontend
        
        UI_APP --> UI_GEN
        UI_APP --> UI_VOTE
        UI_APP --> UI_KEY
        UI_APP --> UI_WALLET
    end

    subgraph State["State Management"]
        REDUX["Redux Store"]:::frontend
        WEB3["Web3 Handler"]:::frontend
        TRANS["Transaction Manager"]:::frontend
        
        REDUX <--> WEB3
        WEB3 <--> TRANS
    end

    subgraph Contracts["Smart Contract Layer"]
        COL["GraviolaCollection"]:::contract
        GEN["GraviolaGenerator"]:::contract
        ARCH["Seasons Archive"]:::contract
        GOV["Governance System"]:::contract
        
        COL <--> GEN
        GEN <--> ARCH
        ARCH <--> GOV
    end

    subgraph External["External Services"]
        ORA["ORA.io"]:::external
        SDIFF["Stable Diffusion API"]:::external
        IPFS["IPFS Storage"]:::external
        ARB["Arbitrum One Sepolia"]:::network
    end

    subgraph Utils["Utility Services"]
        BENCH["Benchmarking System"]:::util
        DEPLOY["Deployment Scripts"]:::util
        VERIFY["Contract Verification"]:::util
    end

    %% Connections
    User --> State
    State --> Contracts
    Contracts --> External
    Utils --> Contracts

    %% Click Events
    click UI_APP "https://github.com/el-tumero/graviola/blob/main/frontend/src/App.tsx"
    click UI_GEN "https://github.com/el-tumero/graviola/blob/main/frontend/src/pages/Generate.tsx"
    click UI_VOTE "https://github.com/el-tumero/graviola/blob/main/frontend/src/pages/Voting.tsx"
    click UI_KEY "https://github.com/el-tumero/graviola/blob/main/frontend/src/pages/Keywords.tsx"
    click UI_WALLET "https://github.com/el-tumero/graviola/blob/main/frontend/src/hooks/useWallet.ts"
    click REDUX "https://github.com/el-tumero/graviola/tree/main/frontend/src/redux/"
    click WEB3 "https://github.com/el-tumero/graviola/blob/main/frontend/src/web3.ts"
    click TRANS "https://github.com/el-tumero/graviola/blob/main/frontend/src/hooks/useTransactionStatus.ts"
    click ARCH "https://github.com/el-tumero/graviola/tree/main/contracts/src/Graviola/seasons/archive/"
    click GOV "https://github.com/el-tumero/graviola/tree/main/contracts/src/Graviola/seasons/governor/"
    click ORA "https://github.com/el-tumero/graviola/tree/main/contracts/src/OAO/"
    click IPFS "https://github.com/el-tumero/graviola/blob/main/frontend/src/utils/convertToIpfsURL.ts"
    click BENCH "https://github.com/el-tumero/graviola/blob/main/benchmarks/main.py"
    click DEPLOY "https://github.com/el-tumero/graviola/blob/main/contracts/utils/deploy.ts"
    click VERIFY "https://github.com/el-tumero/graviola/blob/main/contracts/utils/verify.ts"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef contract fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white
    classDef network fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef util fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        L_FRONT["Frontend"]:::frontend
        L_CONTRACT["Smart Contracts"]:::contract
        L_EXT["External Services"]:::external
        L_NET["Network"]:::network
        L_UTIL["Utilities"]:::util
    end
```
