Simple DAO built with Ethereum smart contracts using Solidity
Table of Contents
- Introduction.
- DAO construction realized with Solidity
- Technical Explanation
- Testing and Deployment Process
- Glossary of Technical Terms
- Related article (Blockchain Public Lecture Series):
Introduction.
The University of Tokyo's "Blockchain Innovation Endowed Program", where students can learn the basics of building a DAO (Decentralized Autonomous Organization) using Solidity, the most suitable language for developing smart contracts for Ethereum, will be explained. The following is an overview of the University of Tokyo's "Blockchain Innovation Endowed Program".
A DAO is a self-sustaining decentralized organization, a decentralized decision-making system designed to bridge the blockchain. Students will learn the basic technology for implementing this system through actual contract development.
DAO construction realized with Solidity
DAO construction flow
- Building a Development Environment Foundry" and "Visual Studio Code" are recommended for Solidity development. These tools are used to develop the development environment.
- Basic Structure Implementation This DAO is constructed with the following basic flow
- Propose Function for DAO members to develop new proposals.
- Vote: Vote Ability to vote Yes/No on proposals.
- Tally (aggregate):. Voting results are tallied by majority vote.
- Execute:. Function to be performed if the proposal is approved.
- Meta Contract implementation The Meta Contract framework simplifies data structures and improves deployment efficiency in DAO development.
- Design of data structures and state transitions
- ER Diagram:. Created a model that formalizes the proposed data structure.
- State Transition Diagrams:. Analyzes a series of DAO operation flows and maps element states.
Technical Explanation
Smart Contract Structure
DAO is implemented based on the following structure
- GlobalState:. A data structure that manages the status of proposals and votes.
- Proposal:. More information about the proposal.
- Include proposer, start time, voting results, etc.
- Vote: Vote for the Stores individual voting information.
DAO state transition
DAO activities are carried out through the following state transitions
- Initial condition: 1 State that no proposal has been made.
- Proposal Submission:. DAO members submit proposals.
- Polling state:. A vote will be taken on the proposal.
- Executable status: "Executable The state in which the proposal was approved.
Testing and Deployment Process
After DAO development, it must be tested and deployed to the network.
- Testing Basics: 1. Find bugs and ensure proper operation through automated testing.
- Fuzzy and combinatorial testing using Foundry.
- Deployment flow:. Deploy to a local network and verify operation on a test net or production environment.
- Using Meta Contract DevKit:. Using the basic operations of Meta Contract, simple deployment of contracts is achieved.
- mc.init():. Prepare a new bundle
- mc.use():. Register features in bundles
- mc.deploy():. Perform compilation of information for deployment
Glossary of Technical Terms
- DAO (Decentralized Autonomous Organization) Self-supporting and decentralized organization.
- Solidity: Solidity Programming language for developing smart contracts for Ethereum.
- Foundry:. A framework for Solidity development.
- TDD (Test-Driven Development) Test-driven development.
- Meta Contract: The A framework that simplifies contracts and provides precise management of data structures.
DAO development is a major area of Web3 and one that is full of promise. We hope that this article will serve as inspiration for those interested in DAO to take on the challenge of development.