Skip to content

accessor-io/dao-registry

Repository files navigation

DAO Registry

Decentralized Autonomous Organization Registry & Governance Platform

DAO Registry is a comprehensive, standards-compliant system for decentralized autonomous organization metadata management, governance, and cross-chain interoperability. Built on Ethereum and compatible with major Layer 2 networks, it implements industry-standard protocols for secure, transparent, and auditable DAO operations.

Core Standards Compliance

  • ERC-20/ERC-721 Integration: Native support for token-based governance and NFT membership
  • EIP-1559 Gas Optimization: Efficient transaction handling with dynamic fee management
  • EIP-712 Structured Data: Type-safe message signing for governance proposals
  • ENS Resolution: Ethereum Name Service integration for human-readable addresses
  • CCIP Cross-Chain: Chainlink CCIP compatibility for multi-chain DAO operations
  • IPFS Metadata: Decentralized storage for immutable DAO documentation
  • OpenZeppelin Security: Industry-standard smart contract security patterns

Key Features

Governance & Voting

  • Multi-signature wallet integration with Gnosis Safe compatibility
  • Quadratic voting mechanisms with ERC-20 token weighting
  • Proposal lifecycle management with timelock controls
  • Delegation patterns following Compound governance standards

Token Economics

  • ERC-20 governance token issuance and distribution
  • Vesting schedules with cliff and linear release patterns
  • Treasury management with multi-asset support
  • Liquidity mining and staking reward mechanisms

Cross-Chain Interoperability

  • Chainlink CCIP for secure cross-chain messaging
  • Layer 2 scaling solutions (Arbitrum, Optimism, Polygon)
  • Multi-chain governance with unified voting power
  • Cross-chain asset bridging and management

Security & Compliance

  • OpenZeppelin contracts with comprehensive audit coverage
  • Multi-sig governance with configurable thresholds
  • Timelock mechanisms for proposal execution delays
  • Emergency pause functionality for critical situations

Developer Experience

  • TypeScript SDK with full type safety
  • Hardhat development environment with testing framework
  • Gas optimization and cost analysis tools
  • Comprehensive API documentation and examples

Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│                    DAO Registry Ecosystem                      │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐          │
│  │   Frontend  │  │   API       │  │   SDK       │          │
│  │   (React)   │  │   Gateway   │  │  (TypeScript)│          │
│  └─────────────┘  └─────────────┘  └─────────────┘          │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐          │
│  │   ENS       │  │   IPFS      │  │   Chainlink │          │
│  │ Resolution  │  │   Storage   │  │   CCIP      │          │
│  └─────────────┘  └─────────────┘  └─────────────┘          │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐          │
│  │   Governance│  │   Treasury  │  │   Token     │          │
│  │   Contracts │  │   Management│  │   Economics │          │
│  └─────────────┘  └─────────────┘  └─────────────┘          │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐          │
│  │   Ethereum  │  │   Layer 2   │  │   Cross-    │          │
│  │   Mainnet   │  │   Networks  │  │   Chain     │          │
│  └─────────────┘  └─────────────┘  └─────────────┘          │
└─────────────────────────────────────────────────────────────────┘

Smart Contract Standards

Core Contracts

DAO Registry Contract (DAORegistry.sol)

  • ERC-165 interface detection
  • EIP-712 structured data signing
  • Access control with OpenZeppelin's AccessControl
  • Events following Ethereum event standards

Governance Token (MockERC20.sol)

  • ERC-20 standard implementation
  • ERC-2612 permit functionality for gasless approvals
  • ERC-20Votes for governance integration
  • Snapshot compatibility for voting power delegation

Treasury Management (MockTreasury.sol)

  • Multi-signature wallet integration
  • Timelock mechanisms for proposal execution
  • Emergency pause functionality
  • Asset management with price oracle integration

Reserved Subdomains (ReservedSubdomains.sol)

  • ENS integration for subdomain management
  • Access control for reserved domain protection
  • Event emission for subdomain lifecycle tracking

Security Features

  • Reentrancy Protection: OpenZeppelin's ReentrancyGuard
  • Access Control: Role-based permissions with AccessControl
  • Pausable: Emergency pause functionality
  • Upgradeable: Proxy pattern for contract upgrades
  • Timelock: Proposal execution delays for security

Installation & Setup

Prerequisites

  • Node.js >= 18.0.0 (LTS)
  • npm >= 9.0.0 or yarn >= 1.22.0
  • Git >= 2.30.0
  • Hardhat development environment

Quick Start

# Clone the repository
git clone https://github.com/your-org/dao-registry.git
cd dao-registry

# Install dependencies
npm install

# Install Hardhat and development tools
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox

# Compile smart contracts
npx hardhat compile

# Run tests
npx hardhat test

# Start local development network
npx hardhat node

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

Environment Configuration

# Copy environment template
cp .env.example .env

# Configure required environment variables
ETHERSCAN_API_KEY=your_etherscan_api_key
ALCHEMY_API_KEY=your_alchemy_api_key
PRIVATE_KEY=your_deployment_private_key
REPORT_GAS=true
COINMARKETCAP_API_KEY=your_coinmarketcap_api_key

API Reference

Core Endpoints

Endpoint Method Description Standards
/api/v1/daos GET List all registered DAOs ERC-20, ERC-721
/api/v1/daos/:id GET Get specific DAO details EIP-712
/api/v1/governance/proposals GET List governance proposals Compound Governance
/api/v1/treasury/balance GET Get treasury balances Multi-asset
/api/v1/tokens/:address GET Get token information ERC-20 Metadata
/api/v1/ens/resolve/:name GET Resolve ENS name ENS Resolution
/api/v1/ipfs/metadata/:hash GET Get IPFS metadata IPFS Gateway

Example Usage

Create a New DAO

curl -X POST http://localhost:3000/api/v1/daos \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "name": "Example DAO",
    "symbol": "EXDAO",
    "description": "A decentralized autonomous organization",
    "governanceToken": {
      "name": "Example DAO Token",
      "symbol": "EXDT",
      "totalSupply": "1000000000000000000000000",
      "decimals": 18
    },
    "treasury": {
      "multisig": "0x1234567890123456789012345678901234567890",
      "timelock": "0x0987654321098765432109876543210987654321"
    },
    "metadata": {
      "website": "https://example-dao.eth",
      "discord": "https://discord.gg/example-dao",
      "twitter": "@example_dao",
      "github": "github.com/example-dao"
    }
  }'

Submit a Governance Proposal

curl -X POST http://localhost:3000/api/v1/governance/proposals \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "daoId": "1",
    "title": "Proposal to Update Treasury Allocation",
    "description": "This proposal seeks to reallocate 20% of treasury funds to DeFi yield farming strategies.",
    "actions": [
      {
        "target": "0x1234567890123456789012345678901234567890",
        "value": "0",
        "data": "0x...",
        "description": "Execute treasury reallocation"
      }
    ],
    "votingPeriod": 604800,
    "executionDelay": 86400
  }'

Query Token Information

curl -X GET http://localhost:3000/api/v1/tokens/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

{
  "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "name": "USD Coin",
  "symbol": "USDC",
  "decimals": 6,
  "totalSupply": "1000000000000000",
  "metadata": {
    "website": "https://www.circle.com/usdc",
    "logo": "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
    "description": "USD Coin (USDC) is a fully collateralized US dollar stablecoin."
  },
  "governance": {
    "votingPower": "1000000000000000",
    "delegatedVotes": "500000000000000",
    "quorumVotes": "100000000000000"
  }
}

Smart Contract Deployment

Mainnet Deployment

# Deploy to Ethereum mainnet
npx hardhat run scripts/deploy.js --network mainnet

# Deploy governance contracts
npx hardhat run scripts/deploy-governance.js --network mainnet

# Deploy treasury contracts
npx hardhat run scripts/deploy-treasury.js --network mainnet

# Verify contracts on Etherscan
npx hardhat verify --network mainnet CONTRACT_ADDRESS

Testnet Deployment

# Deploy to Goerli testnet
npx hardhat run scripts/deploy.js --network goerli

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

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

Layer 2 Deployment

# Deploy to Arbitrum One
npx hardhat run scripts/deploy.js --network arbitrum

# Deploy to Optimism
npx hardhat run scripts/deploy.js --network optimism

# Deploy to Polygon
npx hardhat run scripts/deploy.js --network polygon

Testing & Security

Test Coverage

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run specific test files
npx hardhat test test/DAORegistry.test.js

# Run gas optimization tests
npx hardhat test test/gas-optimization.test.js

# Run security tests
npx hardhat test test/security.test.js

Security Audits

  • OpenZeppelin Contracts: Industry-standard secure implementations
  • Slither Analysis: Static analysis for smart contract vulnerabilities
  • Mythril: Symbolic execution for security analysis
  • Manual Review: Comprehensive code review by security experts

Gas Optimization

  • EIP-1559: Dynamic fee management
  • Batch Operations: Efficient multi-transaction processing
  • Storage Optimization: Minimal storage usage patterns
  • Gas Estimation: Accurate gas cost predictions

Governance Standards

Proposal Lifecycle

  1. Proposal Creation: EIP-712 structured data signing
  2. Voting Period: Configurable duration with quorum requirements
  3. Timelock Delay: Security delay before execution
  4. Execution: Multi-signature or timelock execution
  5. Event Emission: Comprehensive event logging

Voting Mechanisms

  • Token Weighted: ERC-20 token-based voting power
  • Quadratic Voting: Square root of token amount
  • Delegation: ERC-20Votes delegation patterns
  • Snapshot Integration: Off-chain voting with on-chain execution

Treasury Management

  • Multi-signature Wallets: Gnosis Safe integration
  • Timelock Controls: Delayed execution for security
  • Asset Diversification: Multi-asset treasury support
  • Yield Farming: Automated yield generation strategies

Cross-Chain Integration

Chainlink CCIP

// Cross-chain message passing
interface ICrossChainDAO {
    function sendCrossChainProposal(
        uint64 destinationChainSelector,
        address receiver,
        bytes calldata data
    ) external payable;
}

Layer 2 Scaling

  • Arbitrum: Optimistic rollup for high throughput
  • Optimism: Optimistic rollup with EVM compatibility
  • Polygon: Sidechain with fast finality
  • Base: Coinbase's L2 solution

Bridge Integration

  • LayerZero: Omnichain interoperability
  • Axelar: Cross-chain communication
  • Wormhole: Multi-chain asset bridging
  • Hop Protocol: Fast L2 bridging

Development Guidelines

Code Standards

  • Solidity Style Guide: Follow Solidity style guide
  • OpenZeppelin Patterns: Use established security patterns
  • Gas Optimization: Minimize gas costs
  • Event Emission: Comprehensive event logging
  • Error Handling: Proper error messages and handling

Testing Requirements

  • Unit Tests: 100% coverage for all functions
  • Integration Tests: End-to-end workflow testing
  • Security Tests: Vulnerability assessment
  • Gas Tests: Cost optimization verification
  • Fork Tests: Mainnet fork testing

Documentation Standards

  • NatSpec: Comprehensive Solidity documentation
  • API Documentation: OpenAPI/Swagger specifications
  • Architecture Diagrams: System design documentation
  • Deployment Guides: Step-by-step deployment instructions
  • Security Audits: Public audit reports

Contributing

Development Workflow

  1. Fork Repository: Create personal fork
  2. Feature Branch: Create feature branch from main
  3. Development: Implement feature with tests
  4. Code Review: Submit pull request for review
  5. Testing: Ensure all tests pass
  6. Documentation: Update relevant documentation
  7. Merge: Merge after approval

Contribution Guidelines

  • Follow Solidity and TypeScript best practices
  • Write comprehensive tests for all new features
  • Update documentation for API changes
  • Follow security-first development principles
  • Ensure gas optimization for smart contracts
  • Provide clear commit messages and descriptions

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published