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
Adding two matrix from scratch using python.

Adding-two-matrix-from-scratch-using-python. Here, I have take two matrix from user and add it without using any library. I made this program from scr

Sachin Vinayak Dabhade 4 Sep 24, 2021
Prime Path Generator is a prime path generator used to generate prime paths.

Prime Path Generator is a prime path generator used to generate prime paths.

1 Nov 06, 2021
SysInfo is an app developed in python which gives Basic System Info , and some detailed graphs of system performance .

SysInfo SysInfo is an app developed in python which gives Basic System Info , and some detailed graphs of system performance . Installation Download t

5 Nov 08, 2021
password generator

Password generator technologies used What is? It is Password generator How to Download? Download on releases Clone repo git clone https://github.com/m

1 Dec 16, 2021
A Random Password Generator made from Python

Things you need Python Step 1 Download the python file from Releases Step 2 Go to the directory where the python file is and run it Step 3 Type the le

Kavindu Nimsara 3 May 30, 2022
A string extractor module for python

A string extractor module for python

Fayas Noushad 4 Jul 19, 2022
A collection of tools for biomedical research assay analysis in Python.

waltlabtools A collection of tools for biomedical research assay analysis in Python. Key Features Analysis for assays such as digital ELISA, including

Tyler Dougan 1 Apr 18, 2022
Python code to remove empty folders from Windows/Android.

Empty Folder Cleaner is a program that deletes empty folders from your computer or device and removes clutter to improve performance. It supports only windows and android for now.

Dark Coder Cat | Vansh 4 Sep 27, 2022
Pampy: The Pattern Matching for Python you always dreamed of.

Pampy: Pattern Matching for Python Pampy is pretty small (150 lines), reasonably fast, and often makes your code more readable and hence easier to rea

Claudio Santini 3.5k Jan 06, 2023
ColorController is a Pythonic interface for managing colors by english-language name and various color values.

ColorController.py Table of Contents Encode color data in various formats. 1.1: Create a ColorController object using a familiar, english-language col

Tal Zaken 2 Feb 12, 2022
one_click_kag_server is a program which tries to fully automate the creation of a King Arthur's Gold server.

one_click_kag_server is a program which tries to fully automate the creation of a King Arthur's Gold server.

Benjamin Gorman 4 Jan 05, 2022
It is a tool that looks for a specific username in social networks

It is a tool that looks for a specific username in social networks

MasterBurnt 6 Oct 07, 2022
A simple python implementation of Decision Tree.

DecisionTree A simple python implementation of Decision Tree, using Gini index. Usage: import DecisionTree node = DecisionTree.trainDecisionTree(lab

1 Nov 12, 2021
Program to extract signatures from documents.

Extracting Signatures from Bank Checks Introduction Ahmed et al. [1] suggest a connected components-based method for segmenting signatures in document

Muhammad Saif Ullah Khan 9 Jan 26, 2022
Blender 2.93 addon for loading Quake II MD2 files

io_mesh_md2 is a Blender 2.93 addon for importing Quake II MD2 files.

Joshua Skelton 11 Aug 31, 2022
Backup a folder to an another folder by using mirror update method.

Mirror Update Backup Backup a folder to an another folder by using mirror update method. How to use Install requirement pip install -r requirements.tx

1 Nov 21, 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
Small project to interact with python, C, HTML, JavaScript, PHP.

Micro Hidroponic Small project to interact with python, C, HTML, JavaScript, PHP. Table of Contents General Info Technologies Used Screenshots Usage P

Filipe Martins 1 Nov 10, 2021
Python utilities for writing cross-version compatible libraries

Python utilities for writing cross-version compatible libraries

Tyler M. Kontra 85 Jun 29, 2022
Pyfunctools is a module that provides functions, methods and classes that help in the creation of projects in python

Pyfunctools Pyfunctools is a module that provides functions, methods and classes that help in the creation of projects in python, bringing functional

Natanael dos Santos Feitosa 5 Dec 22, 2022