An open source interface for Dai Credit System governance
Install it and run:
npm install
npm run dev
# or
yarn
yarn devRequires node version >= v11.15.0
- Create a local
.envfile - Set
INFURA_KEYto a valid Infura API key - Set
ALCHEMY_KEYto a valid Alchemy API key - Set
TRACING_RPC_NODEto an ethereum RPC parity node with tracing enabled - Set
MONGODB_URIto a full mongodb uri (ex:mongodb+srv://...) - Set
MONGODB_COMMENTS_DBthe mongodb db name to be used for vote comments - Set
USE_PROD_SPOCKto true to use the production spock instance - Set
USE_FS_CACHEto true if you want to use file system cache - Set
GITHUB_TOKENto fetch delegates information from GitHub - Set
NEXT_PUBLIC_USE_MOCKto indicate to use mock data. - Set
NEXT_PUBLIC_MIXPANEL_DEVto the valid Mixpanel dev environment API key - Set
NEXT_PUBLIC_MIXPANEL_PRODto the valid Mixpanel prod environment API key - Set
ALCHEMY_GOERLI_API_KEYfor 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.
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.
- 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
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.
The CI/CD system is integrated with Github Actions.
After each push the system will execute:
- Lint, verify type consistency
- Unit test, execute Jest test suite
- E2E, executy cypress test suite and record results at https://dashboard.cypress.io/projects/uckcr1/runs
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.
See our contributing guide


