The DAO Governance Project is a decentralized autonomous organization (DAO) system implemented on the Ethereum blockchain. It leverages smart contracts to enable a community-driven governance mechanism. The project consists of two primary contracts: DAOGovernor
and DAOToken
.
DAOToken
is an ERC721 token that includes features like enumeration, URI storage, burnability, and voting. This token represents voting power in the DAO, with each token allowing the holder to participate in governance processes.
DAOGovernor
is the governance contract that allows token holders to propose, vote on, and execute changes within the DAO. It integrates with a TimelockController to ensure proposals are executed securely and with a delay, allowing for community review.
- Node.js and npm installed.
- An Ethereum wallet with Ether for deployment.
- An Infura or Alchemy account for Ethereum network access.
-
Clone the repository:
git clone https://github.com/crazyrabbitLTC/NFT-DAO-DEPLOYER
-
Install dependencies:
cd https://github.com/crazyrabbitLTC/NFT-DAO-DEPLOYER npm install
-
Set up environment variables:
- Create a
.env
file in the root directory. - Add environment variables for Ethereum network access and private keys.
- Create a
To deploy the contracts to the Ethereum network:
-
Configure deployment settings in
scripts/daoConfig.ts
:- Set
tokenName
,tokenSymbol
,baseURI
,governorName
, and other parameters.
- Set
-
Run the deployment script:
npx hardhat run scripts/deployDAO.ts --network [yourNetwork]
-
After successful deployment, note down the contract addresses for
DAOGovernor
,DAOToken
, andTimelockController
.
The project includes a comprehensive test suite to validate the functionality of the smart contracts.
To run the tests:
-
Execute the following command:
npx hardhat test
-
The test scripts cover various aspects like token minting, access control, proposal creation, voting mechanisms, and the full proposal cycle.
-
Token Minting and Distribution: The
DAOToken
contract allows designated minters to create new tokens and distribute them to community members or stakeholders. -
Proposal Creation: Token holders can create proposals for changes within the DAO using the
DAOGovernor
contract. Proposals include target contract addresses, calldata, and a description. -
Voting Process: Token holders vote on proposals during the defined voting period. Votes are weighted based on the number of tokens held.
-
Timelock and Execution: Successful proposals are queued in the TimelockController with a delay, allowing for community oversight. After the delay, proposals can be executed, enacting the proposed changes.
-
Governance Control: The
DAOGovernor
contract manages the governance process, ensuring that proposals are handled transparently and securely.
Contributions to the project are welcome. Please follow the standard GitHub fork-and-pull request workflow.
- Fork the repository.
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to modify and personalize the README to better fit your project's specific requirements and characteristics.
This project is based on the template:
A Hardhat-based template for developing Solidity smart contracts, with sensible defaults.
- Hardhat: compile, run and test smart contracts
- TypeChain: generate TypeScript bindings for smart contracts
- Ethers: renowned Ethereum library and wallet implementation
- Solhint: code linter
- Solcover: code coverage
- Prettier Plugin Solidity: code formatter
Click the Use this template
button at the top of the page to
create a new repository with this repo as the initial state.
This template builds upon the frameworks and libraries mentioned above, so for details about their specific features, please consult their respective documentations.
For example, for Hardhat, you can refer to the Hardhat Tutorial and the Hardhat Docs. You might be in particular interested in reading the Testing Contracts section.
This template comes with sensible default configurations in the following files:
├── .editorconfig
├── .eslintignore
├── .eslintrc.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solcover.js
├── .solhint.json
└── hardhat.config.ts
This template is IDE agnostic, but for the best user experience, you may want to use it in VSCode alongside Nomic Foundation's Solidity extension.
This template comes with GitHub Actions pre-configured. Your contracts will be linted and tested on every push and pull
request made to the main
branch.
Note though that to make this work, you must use your INFURA_API_KEY
and your MNEMONIC
as GitHub secrets.
For more information on how to set up GitHub secrets, check out the docs.
You can edit the CI script in .github/workflows/ci.yml.
First, you need to install the dependencies:
$ pnpm install
Then, you need to set up all the required Hardhat Configuration Variables. You might also want to install some that are optional.
To assist with the setup process, run pnpm dlx hardhat vars setup
. To set a particular value, such as a BIP-39
mnemonic variable, execute this:
$ pnpm dlx hardhat vars set MNEMONIC
? Enter value: ‣ here is where your twelve words mnemonic should be put my friend
If you do not already have a mnemonic, you can generate one using this website.
Compile the smart contracts with Hardhat:
$ pnpm compile
Compile the smart contracts and generate TypeChain bindings:
$ pnpm typechain
Run the tests with Hardhat:
$ pnpm test
Lint the Solidity code:
$ pnpm lint:sol
Lint the TypeScript code:
$ pnpm lint:ts
Generate the code coverage report:
$ pnpm coverage
See the gas usage per unit test and average gas per method call:
$ REPORT_GAS=true pnpm test
Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
$ pnpm clean
Deploy the contracts to Hardhat Network:
$ pnpm deploy:contracts
If you use VSCode, you can get Solidity syntax highlighting with the hardhat-solidity extension.
GitPod is an open-source developer platform for remote development. f
To view the coverage report generated by pnpm coverage
, just click Go Live
from the status bar to turn the server
on/off.
$ npm i -g ganache
$ ganache -s test
The
-s test
passes a seed to the local chain and makes it deterministic
Make sure to set the mnemonic in your .env
file to that of the instance running with Ganache.
This project is licensed under MIT.