A simple DAO (Decentralized Autonomous Organization) for the Davidson Blockchain Club. This DAO allows token holders to create proposals, vote on them, and execute successful proposals.
The Davidson DAO consists of three main contracts:
- GovernanceToken: An ERC20 token with voting capabilities
- DavidsonDAO: The main DAO contract that handles proposals and voting
- Box: A contract controlled by the DAO that manages club resources
- Token-based Governance: Members with tokens can vote on proposals
- Proposal Creation: Any member with enough tokens can create a proposal
- Voting: Members can vote for or against proposals
- Execution: Successful proposals can be executed to perform actions
- ERC20 token with voting capabilities (using OpenZeppelin's ERC20Votes)
- Total supply: 1,000,000 tokens
- Allows delegation of voting power
- Manages proposals and voting
- Requires a minimum token threshold to create proposals (1% of total supply)
- Voting period: ~1 week (50,400 blocks with 12s block time)
- Proposals need more votes for than against to pass
- Controlled by the DAO
- Manages club resources:
- Treasury
- Officers
- Projects
- Partnerships
-
Clone the repository:
git clone https://github.com/your-username/Davidson-DAO.git cd Davidson-DAO -
Install dependencies:
forge install
Run the tests:
forge test-
Create a
.envfile with your private key and RPC URL:PRIVATE_KEY=your-private-key RPC_URL=your-rpc-url -
Deploy the contracts:
forge script script/DeployDAO.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
// Encode the function call
bytes memory callData = abi.encodeWithSelector(
box.updateTreasury.selector,
1000 ether
);
// Create the proposal
uint256 proposalId = dao.propose(
"Update Treasury",
"Set the treasury balance to 1000 ether",
address(box),
callData
);// Vote in favor
dao.castVote(proposalId, true);
// Vote against
dao.castVote(proposalId, false);// Execute a successful proposal
dao.execute(proposalId);MIT