A decentralized autonomous organization (DAO) built with Solidity, Foundry, and Next.js. This project enables users to propose, vote, and execute on-chain governance actions.
This project implements a fully functional DAO on Ethereum with the following key capabilities:
- Users can create proposals.
- Members can vote on proposals.
- Proposals are executed on-chain after passing.
The frontend (built with Next.js) interacts seamlessly with the smart contracts deployed on Ethereum using libraries like Wagmi and ethers.js.
- Proposal Creation: Users can propose actions to be voted on.
- Voting System: Members vote on proposals using on-chain mechanisms.
- Execution: Approved proposals trigger smart contract logic.
- NFT-based Access Control: Only holders of specific NFTs can vote or create proposals.
./onchain-dao
|-- foundry/ # Smart contracts (Solidity)
| |-- src/ # Contract source code
| |-- test/ # Tests for smart contracts
|-- frontend/ # Frontend built with Next.js
| |-- src/ # Next.js components and pages
| |-- public/ # Static assets
|-- constants/ # ABI and contract addresses
|-- README.md # Project documentation
|-- package.json # Dependencies
|-- hardhat.config.js # Hardhat configuration (if used)
Follow these steps to set up the project locally:
Ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/yourusername/onchain-dao.git cd onchain-dao
-
Install Frontend Dependencies:
cd frontend npm install
-
Install Foundry: Follow the Foundry installation guide here.
-
Compile Smart Contracts:
cd foundry forge build
-
Run Local Development Server: Navigate to the
frontend
directory and start the Next.js server:cd frontend npm run dev
Your frontend will be live at
http://localhost:3000
.
To deploy your smart contracts using Foundry:
forge script script/Deploy.s.sol --rpc-url <YOUR_RPC_URL> --private-key <YOUR_PRIVATE_KEY>
Update the constants
folder with:
- Deployed Contract ABI
- Contract Addresses
Start the Next.js development server:
npm run dev
- Solidity: Smart contract programming
- Foundry: Development framework for smart contracts
- Next.js: React framework for frontend development
- Wagmi: React hooks for Ethereum
- Ethers.js: Ethereum interaction library
For questions or feedback, checkout https://learnweb3.io
Happy Building! 🚀