Skip to content

ananthanir/dao-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DAO-1: Decentralized Autonomous Organization

A complete DAO (Decentralized Autonomous Organization) implementation built with Solidity, Hardhat, and React. This project demonstrates governance mechanisms, certificate management, and voting systems on the blockchain.

πŸ“‹ Project Overview

This DAO consists of:

  • GovToken (GT): ERC20 governance token with voting capabilities
  • MyGovernor: OpenZeppelin-based governor contract for proposal management
  • TimeLock: Time-delayed execution controller for security
  • Certificate (Cert): Certificate management system controlled by the DAO

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   GovToken  │────│  MyGovernor  │────│  TimeLock   β”‚
β”‚  (ERC20)    β”‚    β”‚ (Governance) β”‚    β”‚ (Security)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                   β”‚ Certificate β”‚
                   β”‚ (Managed)   β”‚
                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Node.js (v18+)
  • npm or pnpm

Installation

  1. Clone the repository

    git clone <repository-url>
    cd dao-1
  2. Install dependencies

    npm install
    # or
    pnpm install
  3. Compile contracts

    npx hardhat compile
  4. Run tests

    npx hardhat test

πŸ”§ Development Commands

Hardhat Commands

# Compile contracts
npx hardhat compile

# Run tests
npx hardhat test

# Start local node
npx hardhat node

# Deploy to local network
npx hardhat run scripts/deploy.js --network localhost

# Deploy to Sepolia testnet
npx hardhat run scripts/deploy.js --network sepolia

Frontend (Vite + React)

# Navigate to UI directory
cd ui

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

πŸ“ Smart Contracts

GovToken.sol

  • Symbol: GT
  • Type: ERC20 + ERC20Permit + ERC20Votes
  • Features: Governance voting, delegation, minting (owner only)
  • Initial Supply: 1,000 GT tokens

MyGovernor.sol

  • Voting Period: 45818 blocks (~1 week)
  • Voting Delay: 7200 blocks (~1 day)
  • Quorum: 4% of total supply
  • Features: Proposal creation, voting, execution via TimeLock

TimeLock.sol

  • Min Delay: 0 seconds (configurable)
  • Purpose: Secure execution of governance proposals
  • Roles: Proposer, Executor, Admin

Cert.sol

  • Purpose: Certificate management system
  • Owner: TimeLock contract (DAO-controlled)
  • Features: Issue and manage certificates

πŸ—³οΈ DAO Governance Flow

  1. Token Distribution: Deploy GovToken and distribute to stakeholders
  2. Delegation: Token holders delegate voting power to themselves or others
  3. Proposal Creation: Create proposals to modify the Certificate contract
  4. Voting Period: Community votes on proposals
  5. Execution: Successful proposals are executed via TimeLock

πŸ§ͺ Testing

The test suite covers:

  • Token deployment and delegation
  • Proposal creation and voting
  • TimeLock execution
  • Certificate management
  • Full governance workflow

Run tests with detailed logs:

npx hardhat test --verbose

🌐 Frontend Integration

The UI folder contains a Vite + React application with:

  • Material-UI components
  • Web3 integration
  • DAO interaction interface

Frontend Dependencies

npm install @mui/material @mui/icons-material @emotion/styled @emotion/react

πŸ” Security Features

  • TimeLock Controller: Prevents immediate execution of proposals
  • Quorum Requirements: Ensures minimum participation
  • Voting Delays: Allows time for community review
  • Role-based Access: Secure permission management

πŸ“Š Network Configuration

Supported Networks

  • Localhost: Local Hardhat node
  • Sepolia: Ethereum testnet
  • Hardhat: Built-in test network

Configuration

See hardhat.config.js for network settings and compiler configuration.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

πŸ“„ License

This project is licensed under the ISC License.

πŸ”— Additional Resources

Git Setup (SSH)

# Generate SSH key
ssh-keygen -t ed25519 -C "your_email@example.com"

# Start SSH agent
eval "$(ssh-agent -s)"

# Add SSH key
ssh-add ~/.ssh/id_ed25519

# Copy public key
cat ~/.ssh/id_ed25519.pub

Useful Links


Built with ❀️ using OpenZeppelin, Hardhat, and React

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors