Smart contract repository for InfraDAO.
- OpenZeppelin contracts
- Proxy Upgradeable Pattern for enhancing modularity
- Hardhat development environment
- Ethers library
- Waffle testing framework
- Sepolia for gas analysis and deployments
- Git installed: run
git --version
to check - NodeJS installed: run
node --version
to check - Yarn installed: run
yarn --version
(or npmnpm --version
)
yarn install
yarn hardhat compile
yarn hardhat test
REPORT_GAS=true yarn hardhat test
Go on the following links and set-up:
- Sepolia project following these steps:
- Click Create App
- Select Chain: Ethereum, Network: Sepolia
- Click on the projects details
- Click on the
View Key
button - Copy the HTTPS RPC URL and add it to
.env
file asSEPOLIA_RPC_URL
- Copy the MetaMask private key of your test account following these instructions
- Save the copied key on
.env
file asPRIVATE_KEY
- Coinmarketcap API key
- Create an account
- Go on
Account
section - Click on
API Keys
, this will copy the private API key on your clipboard - Save the copied key on
.env
file asCOINMARKETCAP_API_KEY
Create .env
file in root directory and add the following variables
SEPOLIA_RPC_URL
PRIVATE_KEY
COINMARKETCAP_API_KEY
Go on hardhat.config.ts
in gasReporter
section and customise the following variables:
gasReporter: {
...
outputFile: 'gas-report.txt', //name of the file where the report will be saved
token: 'ETH', // token used for gas price calculation
currency: 'EUR', // currency used for gas price calculation
}
Then, simply run yarn hardhat test
and the report will be saved in the file specified in outputFile
variable.
yarn hardhat coverage
yarn hardhat node
The following scripts, deploy the master contracts and the sub-dao contracts.
For demonstration purposes, the last 3 scripts are used to prove the following:
- An organization DAO is deployed, along with the registration of its sub-governance modules.
- The
setup-governor
script will allow only the governance contract to queue and execute proposals. - Finally, a sub-dao is deployed and registered to the organization.
In the following order:
yarn hardhat run scripts/deploy-governance-token.ts --network localhost
yarn hardhat run scripts/deploy-membership-nft.ts --network localhost
yarn hardhat run scripts/deploy-timelock.ts --network localhost
yarn hardhat run scripts/deploy-organization-governance.ts --network localhost
yarn hardhat run scripts/deploy-box.ts --network localhost
yarn hardhat run scripts/deploy-all-governance-contracts.ts --network localhost
yarn hardhat run scripts/deploy-dao-factory.ts --network localhost
yarn hardhat run scripts/deploy-org-dao.ts --network localhost
yarn hardhat run scripts/setup-governor.ts --network localhost
yarn hardhat run scripts/deploy-sub-dao.ts --network localhost
Contract addresses will be registered in ./deployments.json
yarn hardhat run scripts/add-first-member.ts --network localhost
yarn hardhat run scripts/propose.ts --network localhost
yarn hardhat run scripts/vote.ts --network localhost
yarn hardhat run scripts/queue-and-execute.ts --network localhost
- Smart contracts
- Hardhat deployment scripts
- Write scripts to interact with them
- Write tests for hardhat
- Integrate with Sepolia network and perform gas analysis
- Deploy to Sepolia network (Future work)