sasicodes / governance-portal-v2

Governance Portal V2

Home Page:https://vote.makerdao.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

maker logo

Waving Hand Maker Governance Portal

An open source interface for Dai Credit System governance

Development

Install it and run:

npm install
npm run dev
# or
yarn
yarn dev

Requires node version >= v11.15.0

Environment (optional)

  1. Create a local .env file
  2. Set INFURA_KEY to a valid Infura API key
  3. Set ALCHEMY_KEY to a valid Alchemy API key
  4. Set TRACING_RPC_NODE to an ethereum RPC parity node with tracing enabled
  5. Set MONGODB_URI to a full mongodb uri (ex: mongodb+srv://...)
  6. Set MONGODB_COMMENTS_DB the mongodb db name to be used for vote comments
  7. Set USE_PROD_SPOCK to true to use the production spock instance
  8. Set USE_FS_CACHE to true if you want to use file system cache
  9. Set GITHUB_TOKEN to fetch delegates information from GitHub
  10. Set NEXT_PUBLIC_USE_MOCK to indicate to use mock data.
  11. Set NEXT_PUBLIC_MIXPANEL_DEV to the valid Mixpanel dev environment API key
  12. Set NEXT_PUBLIC_MIXPANEL_PROD to the valid Mixpanel prod environment API key
  13. Set ALCHEMY_GOERLI_API_KEY for the API key

If API keys aren't provided, both Alchemy and Infura will default to the public keys from ethers.js. This is probably fine in most cases, performance could just be a bit less consistent as many people are using these.

Architecture Diagram

Tests

The Governance portal includes 2 test suite: Jest and Cypress.

Jest tests under the folder tests currently execute unit tests of the platform. The e2e Cypress tests are under the "cypress" folder.

Test Commands

- npm run test -> runs Jest tests on livereload mode
- npm run test:ci -> runs all the Jest tests
- npm run e2e -> opens a Cypress browser for the e2e
- npm run e2e:headless -> runs e2e tests in a headless manner, for CI systems

Goerli Fork

E2E tests run on a fork of GOERLI. We do this because the governance contracts are deployed in Goerli for testing purposes. To run the fork of Goerli on the localhost:8545 (chain id: 31337), execute:

npm run hardhat 

Note: Make sure to fill in the ALCHEMY_GOERLI_API_KEY environment variable. After the network is running you can execute npm run e2e to execute the test suite.

You can use this local network from MetaMask, by switching to the "localhost:8545" network, with chain ID: 31337. In order to get a wallet with some MKR and ETH you can run the script: npm run fund that will send some MKR and ETH to the first 50 wallets under the /cypress/support/constants/keypairs.json.

Writting E2E:

Please refer to: https://docs.cypress.io/guides/references/best-practices and check current test examples under the cypress folder.

CI/CD

The CI/CD system is integrated with Github Actions.

After each push the system will execute:

yarn start:ci

The command yarn start:ci launches a detached process with hardhat, executes e2e in a headless mode and kills the hardhat process.

Contributing

See our contributing guide

About

Governance Portal V2

https://vote.makerdao.com/

License:GNU Affero General Public License v3.0


Languages

Language:TypeScript 91.4%Language:JavaScript 8.6%Language:Shell 0.0%