Quadratic voting DAO dapp for choosing a new Moderator
- Pending changes
- dApp conditions to be met
Clone the repo:
- Open a terminal an run
git clone https://github.com/luloxi/quaxwell-dapp.git
Smart contracts
- Open a terminal on
hardhat
folder - Run
yarn
on hardhat folder to install dependencies. - Run
yarn hardhat node
to start a local blockchain that interacts with the frontend
Backend
- Open a terminal on
backend
folder - Run
yarn
to install dependencies. - Run
node index.js
to start the backend
Interface
- Open a terminal on
interface
folder - Run
yarn
on hardhat folder to install dependencies. - Run
yarn dev
to start a local hosted interface - Open http://localhost:3000 in your web browser.
- Open a terminal on
hardhat
folder - Run
yarn
on hardhat folder to install dependencies. - (optional) Run
yarn hardhat test
to run tests
- Run
yarn hardhat node
to start a local blockchain that interacts with the frontend
- Open
scripts/createProposal.js
in your code editor and complete the fields with your desired data for the proposal - Run
yarn hardhat run scripts/createProposal.js
to create a proposal
- Change name of file .env.example to .env
- Fill the .env file with the settings for the blockchain you want to deploy to *
- Run the deploy command for your blockchain of choice
- If you want to skip contracts verification, don't fill out the ETHERSCAN_API_KEY or POLYGONSCAN_API_KEY variables.
- PRIVATE_KEY: Metamask
- MAINNET_RPC URL: Alchemy (step 1 and 2)
- (optional) ETHERSCAN_API_KEY: Etherscan
- PRIVATE_KEY: Metamask
- GOERLI_RPC URL: Alchemy (step 1 and 2)
- (optional) ETHERSCAN_API_KEY: Etherscan
- Get some Goerli ETH here: Chainlink Faucet - Alchemy Faucet
- PRIVATE_KEY: Metamask
- MUMBAI_RPC_URL: Alchemy (step 1 and 2)
- (optional) POLYGONSCAN_API_KEY: Polygonscan
- Get some Mumbai MATIC here: Mumbai Faucet
- Mainnet:
yarn hardhat run scripts/deployAll.js --network mainnet
- Goerli:
yarn hardhat run scripts/deployAll.js --network goerli
- Mumbai:
yarn hardhat run scripts/deployAll.js --network mumbai
- Open a terminal on
backend
folder - Run
yarn
to install dependencies. - Run
node index.js
to start the backend
- Open a terminal on
backend
folder - Open http://localhost:3001/proposals on your browser to make a call and view the result
- Select to deploy from your repo, then choose the Next type
- Input this parameters:
- Docker image name:
node:lts
- Build command:
yarn
- Base directory:
backend
- Publish directory:
/
- Open a terminal on
interface
folder - Run
yarn
on hardhat folder to install dependencies. - Run
yarn dev
to start a local hosted interface - Open http://localhost:3000 in your web browser.
- Change
/constants/CurrentChain.json
default value to your desired chain name. - Change
/pages/_app.js
jsonRpcUrl rpc value to a valid RPC URL) - Change
../backend/index.js
getDefaultProvider value to a valid RPC URL)
- Available chain names are
hardhat
mumbai
goerli
andmainnet
- Default value
hardhat
is for local testing
- Select to deploy from your repo, then choose the Next type
- Input this parameters:
- Build command:
yarn && yarn build && yarn export
- Publish directory:
out
- Base directory:
interface
- /concept: Reference files for styling.
- /backend: Backend files. Made using Express.
- /hardhat: Smart contracts files. Made using Hardhat
- /interface: Frontend files. Made using Next.js + Wagmi + ChakraUI
- .env: Environment variables. Located on the root folder of the project.
- contracts/: Contracts and libraries for those contracts.
- deploy/: Deploy scripts that work according to hardhat-deploy plugin.
- scripts/: Script to deployAll, and script to Propose as admin.
- test/: Unit testing for Quaxwell contracts
- /components: Custom components for Quaxwell dApp.
- /constants: ABI and Contract addresses for deployed contracts
- /hooks: Custom hooks for conditional behavior
- /pages: Single page base files
- /styles: CSS modules for styling the dApp
- index.js: File with setup and functions for REST API
- Did you set the .env file right?
- Did you save after changing the .env file?
- Delete "artifacts" and "cache" folder and try again.
If you get this error when trying to use your wallet again after using it for interacting with the blockchain with this repo, it's because you used some nonces to send the transactions that deploy or interact with the contracts. In your MetaMask, go to Settings > Advanced > Reset Account
- Install the LTS version of Node
- Open a terminal and run
npm install --global yarn
- (Windows only) Install it with an executable installer
- (Mac only) Install with a command
- (Linux only) Install with a command for your distribution
npm install --global hardhat-shorthand
to use commands like hh node
instead of yarn hardhat node
- Base: Unofficial fork from ferrodri's quadratic-voting-dao
- First stage: Quaxly (evolved because it ate too much noodles (node_modules))