Coder Social home page Coder Social logo

infra-dao's Introduction

InfraDAO - DAO system for Infrastructure teams

Smart contract repository for InfraDAO.

Implementation tech stack:

Contract Architecture

Cast Vote Possibilities

Usage

Pre-requisites

  • Git installed: run git --version to check
  • NodeJS installed: run node --version to check
  • Yarn installed: run yarn --version (or npm npm --version)

Setup

Clone the repo: git clone ...

Install dependencies

yarn install

Compile contracts

yarn hardhat compile

Run tests and get gas report

yarn hardhat test
REPORT_GAS=true yarn hardhat test 

Testnet Gas Reports

Go on the following links and set-up:

  1. 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 as SEPOLIA_RPC_URL
    • Copy the MetaMask private key of your test account following these instructions
    • Save the copied key on .env file as PRIVATE_KEY
  2. 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 as COINMARKETCAP_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.

Get test coverage

yarn hardhat coverage

Run local node

yarn hardhat node

Deploy contracts to local 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-governorscript 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

Interact with contracts:

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

PLAN:

  1. Smart contracts
  2. Hardhat deployment scripts
  3. Write scripts to interact with them
  4. Write tests for hardhat
  5. Integrate with Sepolia network and perform gas analysis
  6. Deploy to Sepolia network (Future work)

infra-dao's People

Stargazers

Ana Raicu avatar

Watchers

Ana Raicu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.