Skip to content

GeniusVentures/gnus-dao-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

176 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GNUS DAO Website

πŸ—³οΈ GNUS DAO Governance Platform

A modern, decentralized autonomous organization (DAO) governance platform built with Next.js 14, featuring quadratic voting, multi-chain support, and Diamond pattern smart contract integration.

πŸ“š Documentation

User Guides

Getting Started

  1. New Users: Start with the Usage Guide
  2. Quick Help: Check the Quick Reference
  3. Developers: Read the Technical Docs

🌟 Features

Core Governance Features

  • βœ… Proposal Creation: Create and submit governance proposals with IPFS metadata storage
  • βœ… Quadratic Voting System: Advanced voting mechanism with cost = votesΒ² formula
  • βœ… Proposal Management: Complete lifecycle from creation to execution
  • βœ… Vote Tracking: Comprehensive voting history and receipts
  • βœ… Treasury Operations: Decentralized fund management
  • βœ… Role Management: Admin controls for treasury managers and permissions
  • βœ… Real-time Updates: Live proposal status and voting results

Advanced Features

  • βœ… Diamond Pattern Integration: Upgradeable smart contracts using EIP-2535
  • βœ… IPFS Integration: Decentralized metadata storage with multiple gateway fallback
  • βœ… Multi-Wallet Support: MetaMask, WalletConnect, and other Web3 wallets
  • βœ… Mobile Responsive: Optimized interface for all devices
  • βœ… Error Handling: Comprehensive error tracking and user feedback
  • βœ… Security Features: Input validation, rate limiting, and safe transactions

Technical Stack

  • Frontend: Next.js 14.2.35 with TypeScript
  • Styling: Tailwind CSS with custom components
  • State Management: Redux Toolkit
  • Web3: ethers.js v6 with TypeChain
  • Smart Contracts: Diamond pattern (7 facets)
  • Network: Ethereum Sepolia Testnet

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and yarn
  • MetaMask or compatible Web3 wallet

Development

# Install dependencies
yarn install

# Start development server
yarn dev

# Open http://localhost:3000

Deployment

# Build and deploy to Cloudflare Pages
yarn deploy:pages

# Or build only
yarn build:pages

πŸ“‹ For detailed deployment instructions, see DEPLOYMENT.md

  • Access to Sepolia testnet (for development)

Installation

# Clone the repository
git clone <repository-url>
cd gnus-dao-website

# Install dependencies
yarn install

# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your configuration

# Start development server
yarn dev

First Time Setup

  1. Connect Wallet: Use MetaMask on Sepolia testnet
  2. Get Test Tokens: Acquire GNUS tokens for voting
  3. Explore Interface: Check out proposals and treasury
  4. Cast First Vote: Participate in governance

For detailed setup instructions, see the Usage Guide.

Environment Configuration

Create a .env.local file with the following variables:

# WalletConnect Configuration
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=805f6520f2f2934352c65fe6bd70d15d

# Network Configuration (Sepolia Testnet)
NEXT_PUBLIC_SEPOLIA_RPC_URL=
NEXT_PUBLIC_SEPOLIA_GNUS_DAO_ADDRESS=0x57AE78C65F7Dd6d158DE9F4cA9CCeaA98C988199

# IPFS Configuration (Pinata)
NEXT_PUBLIC_PINATA_API_KEY=your_pinata_api_key
NEXT_PUBLIC_PINATA_SECRET_KEY=your_pinata_secret_key
NEXT_PUBLIC_PINATA_JWT=your_pinata_jwt_token

πŸ“ Project Structure

src/
β”œβ”€β”€ app/                    # Next.js 14 App Router pages
β”‚   β”œβ”€β”€ proposals/         # Proposal management pages
β”‚   β”‚   β”œβ”€β”€ page.tsx       # Main proposals listing
β”‚   β”‚   └── [id]/          # Individual proposal details
β”‚   β”œβ”€β”€ treasury/          # Treasury management
β”‚   β”œβ”€β”€ analytics/         # DAO analytics dashboard
β”‚   └── governance/        # Governance settings
β”œβ”€β”€ components/            # Reusable React components
β”‚   β”œβ”€β”€ proposals/         # Proposal-related components
β”‚   β”‚   β”œβ”€β”€ CreateProposalModal.tsx  # Proposal creation
β”‚   β”‚   └── ProposalCard.tsx         # Proposal display
β”‚   β”œβ”€β”€ voting/           # Voting interface components
β”‚   β”œβ”€β”€ wallet/           # Wallet connection components
β”‚   └── ui/               # Base UI components (Button, Modal, etc.)
β”œβ”€β”€ lib/                  # Core business logic
β”‚   β”œβ”€β”€ contracts/        # Smart contract interactions
β”‚   β”‚   β”œβ”€β”€ gnusDaoService.ts        # Main DAO service
β”‚   β”‚   └── GNUSDAODiamond.json      # Contract ABI
β”‚   β”œβ”€β”€ web3/            # Web3 provider and Redux store
β”‚   β”œβ”€β”€ ipfs/            # IPFS integration (Pinata)
β”‚   └── utils/           # Utility functions
β”œβ”€β”€ types/               # TypeScript type definitions
└── scripts/             # Build and deployment scripts

πŸ”§ Development

Available Scripts

# Development
yarn dev                    # Start development server (port 3000)
yarn dev:turbo             # Start development server with Turbopack

# Building
yarn build                 # Standard Next.js build
yarn build:production      # Production build with optimizations for Cloudflare Pages

# Testing
yarn test                  # Run unit tests
yarn test:coverage         # Run tests with coverage
yarn test:e2e             # Run Playwright end-to-end tests
yarn test:e2e:ui          # Run Playwright tests with UI
yarn validate             # Run type-check + lint + tests

# Code Quality
yarn lint                  # Run ESLint
yarn lint:fix             # Fix linting issues automatically
yarn type-check           # TypeScript type checking
yarn format               # Format code with Prettier

# Deployment
yarn deploy:prepare        # Build for production
yarn deploy:cloudflare     # Deploy to Cloudflare Pages

# Maintenance
yarn clean                 # Clean build artifacts
yarn clean:all            # Clean everything including node_modules

Testing Strategy

The project includes comprehensive testing:

  • βœ… Unit Tests: Jest with React Testing Library for component testing
  • βœ… E2E Tests: Playwright for end-to-end user flow testing
  • βœ… Type Safety: Full TypeScript coverage with strict mode
  • βœ… Linting: ESLint with custom rules for Web3 development
  • βœ… Integration Tests: Contract interaction testing

Development Workflow

  1. Local Development: yarn dev starts the development server
  2. Code Quality: yarn validate runs all quality checks
  3. Testing: yarn test:coverage ensures >80% test coverage
  4. Building: yarn build:hybrid creates production-ready build
  5. Deployment: Automatic deployment via GitHub Actions

🌐 Deployment

Cloudflare Pages (Production)

The project is optimized for Cloudflare Pages deployment:

# Build for production
yarn build:production

# Deploy using Wrangler CLI
yarn deploy:cloudflare

Live Deployment: https://gnus-dao-web.pages.dev

GitHub Actions CI/CD

Automated deployment pipeline includes:

  • βœ… Code Quality Checks: TypeScript, ESLint, Prettier
  • βœ… Automated Testing: Unit and integration tests
  • βœ… Build Verification: Ensures successful production builds
  • βœ… Automatic Deployment: Deploy to Cloudflare Pages on main branch
  • βœ… Preview Deployments: Deploy preview for pull requests

πŸ—οΈ Architecture

Smart Contract Integration

The platform integrates with Diamond pattern smart contracts (EIP-2535):

  • βœ… Upgradeable Architecture: Modular contract system with facets
  • βœ… Gas Optimization: Efficient function delegation and storage
  • βœ… Feature Modularity: Separate facets for proposals, voting, treasury
  • βœ… Contract Address: 0x57AE78C65F7Dd6d158DE9F4cA9CCeaA98C988199 (Sepolia)

Key Contract Functions

// Proposal Management
propose(title: string, ipfsHash: string) β†’ uint256
getProposalBasic(proposalId: uint256) β†’ (id, proposer, title, ipfsHash)
getProposalStatus(proposalId: uint256) β†’ (startTime, endTime, totalVotes, executed, cancelled)

// Voting System
vote(proposalId: uint256, votes: uint256) β†’ void
hasVoted(proposalId: uint256, voter: address) β†’ bool
getVote(proposalId: uint256, voter: address) β†’ uint256

// Configuration
getVotingConfig() β†’ (proposalThreshold, votingDelay, votingPeriod, quorumThreshold)

πŸ“Š Current Status

βœ… Completed Features

  • Proposal Creation: Full end-to-end proposal creation with IPFS upload

  • Proposal Display: Real-time proposal states and time remaining

  • Wallet Integration: WalletConnect v2 support and MetaMask support

  • Navigation: Seamless routing between proposal list and details

  • State Management: Proper proposal state calculation from contract data

  • Error Handling: Comprehensive error handling and user feedback

  • Build System: Hybrid build for Cloudflare Pages deployment

  • CI/CD Pipeline: Automated testing and deployment

πŸ”„ Current Tasks

  • Enhanced UI/UX: Improve visual design and user experience
  • Wallet Integration: WalletConnect v2 support, SIWE for cloudflare
  • Voting System: Vote For/Against functionality with wallet integration
  • Performance Optimization: Optimize bundle size and loading times
  • Advanced Voting: Implement delegation and quadratic voting features
  • Treasury Management: Add treasury proposal and execution features
  • Analytics Dashboard: Implement governance analytics and metrics

About

Front End Website for the GNUS DAO

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors