Work with this repo in the browser (optional)
It's recommended that you've gone through the hardhat getting started documentation before proceeding here.
- git
- You'll know you did it right if you can run
git --version
and you see a response likegit version x.x.x
- You'll know you did it right if you can run
- Nodejs
- You'll know you've installed nodejs right if you can run:
node --version
and get an ouput like:vx.x.x
- You'll know you've installed nodejs right if you can run:
- Yarn instead of
npm
- You'll know you've installed yarn right if you can run:
yarn --version
And get an output like:x.x.x
- You might need to install it with npm
- You'll know you've installed yarn right if you can run:
- Clone this repo:
git clone https://github.com/PatrickAlphaC/dao-template
cd dao-template
- Install dependencies
yarn
or
npm i
- Run the test suite (which also has all the functionality)
yarn hardhat test
or
npx hardhat test
If you want to deploy to a testnet:
4. Add a .env
file with the same contents of .env.example
, but replaced with your variables.
WARNING
DO NOT PUSH YOUR PRIVATE_KEY TO GITHUB
- Deploy to testnet e.g. goerli
npm run deploy goerli
- Verify contracts at 0x... through etherscan API
npm run verify goerli 0x...
Here is the rundown of what the test suite does.
- We will deploy an ERC20 token that we will use to govern our DAO.
- We will deploy our Governence contract
- Note: The Governance contract is in charge of proposals
- We will deploy a simple Box contract, which will be owned by our Governence contract!.
- We will submit a proposal to mint some token to an address.
- We will then vote on that proposal.
- We will then execute the proposal if passed.
You can also use the Openzeppelin contract wizard to get other contracts to work with variations of this governance contract.
- Upgradeable contracts with the TransparentUpgradeableProxy pattern
- [] Add tests
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
- Openzeppelin Governance Walkthrough
- Openzeppelin Governance Github
- Vitalik on DAOs
- Vitalik on On-Chain Governance
- Vitalik on Governance in General
You can check out the openzeppelin javascript tests for a full suite of an example of what is possible.