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
A collection of custom scripts for working with Quake assets.

Custom Quake Tools A collection of custom scripts for working with Quake assets. Features Script to list all BSP files in a Quake mod

Jason Brownlee 3 Jul 5, 2022
A tool written in python to generate basic repo files from github

A tool written in python to generate basic repo files from github

Riley 7 Dec 2, 2021
This is discord nitro code generator and checker made with python. This will generate nitro codes and checks if the code is valid or not. If code is valid then it will print the code leaving 2 lines and if not then it will print '*'.

Discord Nitro Generator And Checker ⚙️ Rᴜɴ Oɴ Rᴇᴘʟɪᴛ ??️ Lᴀɴɢᴜᴀɢᴇs Aɴᴅ Tᴏᴏʟs If you are taking code from this repository without a fork, then atleast

Vɪɴᴀʏᴀᴋ Pᴀɴᴅᴇʏ 37 Jan 7, 2023
🔩 Like builtins, but boltons. 250+ constructs, recipes, and snippets which extend (and rely on nothing but) the Python standard library. Nothing like Michael Bolton.

Boltons boltons should be builtins. Boltons is a set of over 230 BSD-licensed, pure-Python utilities in the same spirit as — and yet conspicuously mis

Mahmoud Hashemi 6k Jan 4, 2023
A Python utility belt containing simple tools, a stdlib like feel, and extra batteries. Hashing, Caching, Timing, Progress, and more made easy!

Ubelt is a small library of robust, tested, documented, and simple functions that extend the Python standard library. It has a flat API that all behav

Jon Crall 638 Dec 13, 2022
isort is a Python utility / library to sort imports alphabetically, and automatically separated into sections and by type.

isort is a Python utility / library to sort imports alphabetically, and automatically separated into sections and by type. It provides a command line utility, Python library and plugins for various editors to quickly sort all your imports.

Python Code Quality Authority 5.5k Jan 8, 2023
A library for interacting with Path of Exile game and economy data, and a unique loot filter generation framework.

wraeblast A library for interfacing with Path of Exile game and economy data, and a set of item filters geared towards trade league players. Filter Ge

David Gidwani 29 Aug 28, 2022
A script to parse and display buy_tag and sell_reason for freqtrade backtesting trades

freqtrade-buyreasons A script to parse and display buy_tag and sell_reason for freqtrade backtesting trades Usage Copy the buy_reasons.py script into

Robert Davey 31 Jan 1, 2023
Application for easy configuration of swap file and swappiness priority in slackware and others linux distributions.

Swap File Program created with the objective of assisting in the configuration of swap file in Distributions such as Slackware. Required packages: pyt

Mauricio Ferrari 3 Aug 6, 2022
kawadi is a versatile tool that used as a form of weapon and is used to cut, shape and split wood.

kawadi kawadi (કવાડિ in Gujarati) (Axe in English) is a versatile tool that used as a form of weapon and is used to cut, shape and split wood. kawadi

Jay Vala 2 Jan 10, 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 Building instrutions

Micah Lee 26 Dec 27, 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 python lib for generate random string and digits and special characters or A combination of them

A python lib for generate random string and digits and special characters or A combination of them

Torham 4 Nov 15, 2022
Cleaning-utils - a collection of small Python functions and classes which make cleaning pipelines shorter and easier

cleaning-utils [] [] [] cleaning-utils is a collection of small Python functions

null 4 Aug 31, 2022
A fancy and practical functional tools

Funcy A collection of fancy functional tools focused on practicality. Inspired by clojure, underscore and my own abstractions. Keep reading to get an

Alexander Schepanovski 2.9k Jan 7, 2023
Make your functions return something meaningful, typed, and safe!

Make your functions return something meaningful, typed, and safe! Features Brings functional programming to Python land Provides a bunch of primitives

dry-python 2.6k Jan 9, 2023
Toolkit for collecting and applying templates of prompting instances

PromptSource Toolkit for collecting and applying templates of prompting instances. WIP Setup Download the repo Navigate to root directory of the repo

BigScience Workshop 1k Jan 5, 2023
Extract the download URL from OneDrive or SharePoint share link and push it to aria2

OneDriveShareLinkPushAria2 Extract the download URL from OneDrive or SharePoint share link and push it to aria2 从OneDrive或SharePoint共享链接提取下载URL并将其推送到a

高玩梁 262 Jan 8, 2023
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

null 5 Nov 8, 2021