A repo for working with and building daos

Overview

DAO Mix

About

How to DAO

This repo is meant to give you all the knowledge you need to start a DAO and do governance. Since what's the point of a DAO if you can't make any decisions! There are 2 main kinds of doing governance.

Feature On-Chain Governance Hybrid Governance
Gas Costs More Expensive Cheaper
Components Just the blockchain An oracle or trusted multisig

A typical on-chain governance structure might look like:

  • ERC20 based voting happens on a project like Tally, but could hypothetically be done by users manually calling the vote functions.
  • Anyone can execute a proposal once it has passed Examples Compound

On-chain governance can be much more expensive, but involves fewer parts, and the tooling is still being developed.

A typical hybrid governance with an oracle might look like:

  • ERC20 based voting happens on a project like Snapshot
  • An oracle like Chainlink is used to retreive and execute the answers in a decentralized manner.

A typical hybrid governance with a trusted multisig might looks like:

Hybrid governance is much cheaper, just as secure, but the tooling is still being developed.

Tools:

No Code Tools

The following have tools to help you start a DAO without having to deploy contracts yourself.

(back to top)

Getting Started

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • Python
  • brownie
    python3 -m pip install --user pipx
    python3 -m pipx ensurepath
    # restart terminal
    pipx install eth-brownie

If you want to test and run locally:

Installation

  1. Clone this repo:
    git clone https://github.com/brownie-mix/dao-mix
    cd dao-mix
    
  2. Install hardhat
    yarn add hardhat

If you want to deploy to a testnet: 3. Add a .env file with the same contents of .env.example, but replaced with your variables.

  1. DO NOT PUSH YOUR PRIVATE_KEY TO GITHUB
  2. Add dotenv: .env to your brownie-config.yaml

Usage

On-Chain Governance Example

We have just 1 script in the scripts folder at the moment. This will take you through the whole process of governance.

  1. We will deploy an ERC20 token that we will use to govern our DAO.
  2. We will deploy a Timelock contract that we will use to give a buffer between executing proposals.
    1. Note: The timelock is the contract that will handle all the money, ownerships, etc
  3. We will deploy our Governence contract
    1. Note: The Governance contract is in charge of proposals and such, but the Timelock executes!
  4. We will deploy a simple Box contract, which will be owned by our governance process! (aka, our timelock contract).
  5. We will propose a new value to be added to our Box contract.
  6. We will then vote on that proposal.
  7. We will then queue the proposal to be executed.
  8. Then, we will execute it!
brownie run scripts/governance_standard/deploy_and_run.py

Or, to a testnet

brownie run scripts/governance_standard/deploy_and_run.py --network kovan

You can also use the Openzeppelin contract wizard to get other contracts to work with variations of this governance contract.

Off-Chain governance Example

This sectoin is still being developed.

Deploy your ERC20 and make proposals in snapshot.

(back to top)

Roadmap

  • [] Add Upgradeability examples with the UUPS proxy pattern
  • [] Add Chainlink Oracle Integration with Snapsafe example

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Brownie - @BrownieEth Patrick Collins - @patrickalphac

(back to top)

Acknowledgments

(back to top)

You can check out the openzeppelin javascript tests for a full suite of an example of what is possible.

Comments
  • Get proposal id with events

    Get proposal id with events

    • Get proposal id with events to avoid problems when using RPC node does not support debug_traceTransaction
    • Import ERC20Votes in GovernorContract for build
    opened by Techget 3
  • Met problem about `debug_traceTransaction` for RPC endpoint when `TransactionReceipt.return_value` is used.

    Met problem about `debug_traceTransaction` for RPC endpoint when `TransactionReceipt.return_value` is used.

    Dear developer,

    Context: Recently, I tried to use this implementation and deploy it to Polygon(Mumbai) with Infura as the node provider and Brownie.

    Related doc for brownie TransactionReceipt.return_value

    Problem: Received error message as

    RPCRequestError: Accessing `TransactionReceipt.return_value` on a confirmed transaction requires the `debug_traceTransaction` RPC endpoint, but the node client does not support it or has not made it available.
    

    Question:

    • Do you have some ideas about the workaround we can use in this case?
    • Do you consider to implement a version where it records the latest proposal_id as a state so that we can query the Governor contract instead?

    Thanks

    opened by Techget 2
  • deploy_and_run.py lacks a

    deploy_and_run.py lacks a "mint" call before delegating votes.

    When calling def deploy_governor(): we initially deploy the governance token, then the script calls governance_token.delegate(account, {"from": account}), but we have not called any mint function before; what occurs next is you voting with no weight.

    Here is the event I was getting when voting:

    OrderedDict([('voter', '0x66aB6D9362d4F35596279692F0251Db635165871'), ('proposalId', 89032801670644786090896159984413409335377199854927541874931809450777628720361), ('support', 1), ('weight', 0), ('reason', 'Cuz I lika do da cha cha')])

    Same event after including a mint function:

    OrderedDict([('voter', '0x66aB6D9362d4F35596279692F0251Db635165871'), ('proposalId', 25225749521061997514179783119955564126875735072184429625011844126970089268040), ('support', 1), ('weight', 1), ('reason', 'Cuz I lika do da cha cha')])

    opened by henryf10h 1
  • FIX: TimelockController, operation is not ready

    FIX: TimelockController, operation is not ready

    Hey, @PatrickAlphaC

    I've run into the same issue as you do during live of "code a dao, python version".

    So far the problem reproducing when trying to use ganache local chain, which in brownie of version 1.16.4 set as development network with this config,

    Ganache-CLI
        id: development
        cmd: ganache-cli
        cmd_settings: {'accounts': 10, 'evm_version': 'istanbul', 'gas_limit': 12000000, 'mnemonic': 'brownie', 'port': 8545}
        host: http://127.0.0.1
    

    Here's a patch which fixes timelockcontroller revert with simple delay between queue and execute trx

    BTW, thanks for your outstanding efforts at democratization of blockchain development,

    best of luck!

    opened by eatsleepraverepeat 1
  • the deploy script fails on type error

    the deploy script fails on type error

    Followed instruction, got bug

    brownie run scripts/governance_standard/deploy_and_run.py
    Brownie v1.19.0 - Python development framework for Ethereum
    
    New compatible solc version available: 0.8.14
    Compiling contracts...
      Solc version: 0.8.14
      Optimizer: Enabled  Runs: 200
      EVM Version: Istanbul
    CompilerError: solc returned the following errors:
    
    TypeError: Data locations of parameters have to be the same when overriding non-external functions, but they differ.
      --> /Users/tinytaplife/.brownie/packages/OpenZeppelin/[email protected]/contracts/governance/Governor.sol:92:5:
       |
    92 |     function hashProposal(
       |     ^ (Relevant source part starts here and spans across multiple lines).
    Note: Overridden function is here:
      --> /Users/tinytaplife/.brownie/packages/OpenZeppelin/[email protected]/contracts/governance/IGovernor.sol:91:5:
       |
    91 |     function hashProposal(
       |     ^ (Relevant source part starts here and spans across multiple lines).
    
    opened by aniche 3
Releases(0.0.1)
Owner
Brownie Mixes
Premade templates for use with Brownie
Brownie Mixes
cssOrganizer - organize a css file by grouping them into categories

This python project was created to scan through a CSS file and produce a more organized CSS file by grouping related CSS Properties within selectors. Created in my spare time for fun and my own utili

Andrew Espindola 0 Aug 31, 2022
Install, run, and update apps without root and only in your home directory

Qube Apps Install, run, and update apps in the private storage of a Qube. Build and install in Qubes Get the code: git clone https://github.com/micahf

Micah Lee 26 Dec 27, 2022
A simple tool that updates your pubspec.yaml file, of a Flutter project, without altering the structure of your file.

A simple tool that updates your pubspec.yaml file, of a Flutter project, without altering the structure of your file.

3 Dec 10, 2021
WindowsDebloat - Windows Debloat with python

Windows Debloat 🗑️ Quickly and easily configure Windows 10. Disclaimer I am NOT

1 Mar 26, 2022
Dependency injection lib for Python 3.8+

PyDI Dependency injection lib for python How to use To define the classes that should be injected and stored as bean use decorator @component @compone

Nikita Antropov 2 Nov 09, 2021
Utility to add/remove licenses to/from source files

Utility to add/remove licenses to/from source files. Supports processing any combination of globs, files, and directories (recurse). Pruning options allow skipping non-licensing files.

Eduardo Ponce Mojica 2 Jan 29, 2022
Create a Web Component (a Custom Element) from a python file

wyc Create a Web Component (a Custom Element) from a python file (transpile python code to javascript (es2015)). Features Use python to define your cu

7 Oct 09, 2022
python-codicefiscale: a tiny library for encode/decode Italian fiscal code - codifica/decodifica del Codice Fiscale.

python-codicefiscale python-codicefiscale is a tiny library for encode/decode Italian fiscal code - codifica/decodifica del Codice Fiscale. Features T

Fabio Caccamo 53 Dec 14, 2022
Dill_tils is a package that has my commonly used functions inside it for ease of use.

DilllonB07 Utilities Dill_tils is a package that has my commonly used functions inside it for ease of use. Installation Anyone can use this package by

Dillon Barnes 2 Dec 05, 2021
Raganarok X: Next Generation Data Dump

Raganarok X Data Dump Raganarok X: Next Generation Data Dump More interesting Files File Name Contains en_langs All the variables you need in English

14 Jul 15, 2022
Modeling Category-Selective Cortical Regions with Topographic Variational Autoencoders

Modeling Category-Selective Cortical Regions with Topographic Variational Autoencoders Getting Started Install requirements with Anaconda: conda env c

T. Andy Keller 4 Aug 22, 2022
Let's renew the puzzle collection. We'll produce a collection of new puzzles out of the lichess game database.

Let's renew the puzzle collection. We'll produce a collection of new puzzles out of the lichess game database.

Thibault Duplessis 96 Jan 03, 2023
Build capture utility for Linux

CX-BUILD Compilation Database alternative Build Prerequisite the CXBUILD uses linux system call trace utility called strace which was customized. So I

GLaDOS (G? L? Automatic Debug Operation System) 3 Nov 03, 2022
This tool lets you perform some quick tasks for CTFs and Pentesting.

This tool lets you convert strings and numbers between number bases (2, 8, 10 and 16) as well as ASCII text. You can use the IP address analyzer to find out details on IPv4 and perform abbreviation a

Ayomide Ayodele-Soyebo 1 Jul 16, 2022
A repository containing several general purpose Python scripts to automate daily and common tasks.

General Purpose Scripts Introduction This repository holds a curated list of Python scripts which aim to help us automate daily and common tasks. You

GDSC RCCIIT 46 Dec 25, 2022
A python package containing all the basic functions and classes for python. From simple addition to advanced file encryption.

A python package containing all the basic functions and classes for python. From simple addition to advanced file encryption.

PyBash 11 May 22, 2022
A utility tool to create .env files

A utility tool to create .env files dump-env takes an .env.template file and some optional environmental variables to create a new .env file from thes

wemake.services 89 Dec 08, 2022
Make some improvements in the Pizza class and pizzashop file by refactoring.

Make some improvements in the Pizza class and pizzashop file by refactoring.

James Brucker 1 Oct 18, 2021
Cardano Stakepools: Check for scheduled blocks in current epoch.

ReLeaderLogs For Cardano Stakepool Operators: Lightweight Scheduled Blocks Checker for Current Epoch. No cardano-node Required, data is taken from blo

SNAKE (Cardano Stakepool) 2 Oct 19, 2021
ULID implementation for Python

What is this? This is a port of the original JavaScript ULID implementation to Python. A ULID is a universally unique lexicographically sortable ident

Martin Domke 158 Jan 04, 2023