This is a section of the Cyfrin Foundry Solidity Course.
⭐️ (6:05:45) | Lesson 14 | DAOs & Governance
This is a Solidity-based DAO implementation using OpenZeppelin.
Many tools and solutions exist to build a DAO (Tally, Snapshot, Aragon...). While it's possible to build a DAO from scratch, leveraging well-known solutions like OpenZeppelin can offer several advantages:
- Security: Established solutions have been thoroughly tested and audited, reducing the risk of vulnerabilities.
- Community Support: Using popular tools means access to a wider community for help, resources, and collaboration.
- Time Efficiency: Building on top of existing frameworks can significantly reduce development time and effort.
In this repository, we delve into the creation of a Decentralized Autonomous Organization (DAO) by using OpenZeppelin's smart contract libraries. Through the implementation of a simple test using Foundry, we aim to demonstrate the seamless deployment and execution of a proposal, showcasing the practical application of decentralized governance principles.
Please note: ERC20 based voting is not always recommended, we should explore other forms of governance like reputation based or "skin-in-the-game" based. An article on money-based voting being bad.
- 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
- foundry
- You'll know you did it right if you can run
forge --version
and you see a response likeforge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)
- You'll know you did it right if you can run
git clone https://github.com/ibourn/foundry-dao
cd foundry-dao
forge install
forge build
forge test
No deployment script for this project, we focus on the implementation of contracts and we have just a test to demonstrate the end-to-end use of the DAO with the life cycle of a proposal from submission to execution.
You can estimate how much gas things cost by running:
forge snapshot
And you'll see and output file called .gas-snapshot
To run code formatting:
forge fmt