This is the repo containing the code for the Sky Governance Portal. The Sky Governance Portal is an open-source interface for governance of the Sky protocol.
Copyright Dai Foundation 2022.
While the portal is hosted by Sky at https://vote.makerdao.com, it can also be run by anyone on their local machine.
In order to run the project locally, you must have the following installed on the machine:
- Node, version 18.17 or greater (up to version 20.x) (install)
To get started, clone the repository to the desired directory and then navigate into the project folder:
# clones repo
git clone https://github.com/makerdao/governance-portal-v2.git
# changes directory to cloned project folder
cd governance-portal-v2Next, install the project's dependencies using pnpm:
# installs dependencies
pnpm i
# runs the application on localhost:3000
pnpm dev
At this point, you should be able to access the application by going to the address http://localhost:3000 in your browser.
To do releases of the governance portal, please use npm version minor or npm version patch to bump the version in the package.json and create a tag.
The tag and versioning should be done on develop, and then merged to master through a PR. To push your local tag use the command git push origin develop --follow-tags.
The portal seeks to rely on on-chain data as much as possible and to minimize reliance on data stored on centralized servers. However, due to the large volume of data that is relevant to Sky governance, fetching this data from on-chain is both time and resource-intensive. In order to improve the user's experience, some reliance on third-party services has been added, and we recommend a few configuration steps for optimal use. These services include:
- GitHub for storing markdown related to polls, executives, and aligned delegates
The portal uses the Wagmi library in order to communicate with the Ethereum network through its React hooks, and Viem in order to do so through its public client as well as provide Web3 utilities. Both Wagmi and Viem work by connecting to JSON-RPC APIs via HTTP in order to provide on-chain data to web applications. By default, they provide default RPC URLs that can be used to get started. However, these RPCs keys can quickly become rate-limited when too many requests are made. In order to prevent this, it is recommended that you sign up and add your own API keys to the configuration.
Due to the large volume of data that is constantly being fetched and displayed in the portal, we use caching in order to cache various network responses for a limited amount of time. This helps to reduce the load of networking calls to various APIs. This feature can be configured to be on or off.
To begin, create a local .env file in the project's root directory. The .env.sample file can be used as a template.
The following configuration values can be added to the .env file:
-
Set
NEXT_PUBLIC_RPC_MAINNETto a valid Ethereum mainnet RPC URL (e.g. from Alchemy, Infura, Tenderly, etc) -
Set
NEXT_PUBLIC_RPC_ARBITRUMto a valid Arbitrum mainnet RPC URL -
Set
NEXT_PUBLIC_RPC_ARBITRUM_TESTNETto a valid Arbitrum testnet RPC URL -
Set
ETHERSCAN_V2_API_KEYto a valid Etherscan V2 API key for Wagmi to be able to generate the contract ABIs -
Set
USE_CACHEto true if you want to use cache, ifREDIS_URLis set it will use REDIS otherwise filesystem cache -
Set
GASLESS_DISABLEDtotrueto disable gasless voting in UI (pre-check endpoint will fail) -
Set
NEXT_PUBLIC_VERCEL_ENVtodevelopmentto use development environment databases
-
Set
MIGRATION_WEBHOOK_URLfor sending migration requests to discord -
Set
GASLESS_WEBHOOK_URLfor sending gasless vote requests to discord
Optional Set DEFENDER_API_KEY_MAINNET and/or DEFENDER_API_KEY_TESTNET to a valid OpenZeppelin Defender Relay key (used for gasless poll voting)
Optional Set DEFENDER_API_SECRET_MAINNET and/orDEFENDER_API_SECRET_TESTNET to a valid OpenZeppelin Defender Relay secret
Optional Set GASLESS_BACKDOOR_SECRET to allow for bypassing the gasless voting eligibility checks by anyone with the password
- Set
DASHBOARD_PASSWORDfor adding protection to the/dashboardroute
Required for e2e:
- Set
NEXT_PUBLIC_TENDERLY_RPC_KEYto the API key required to query the forked Tenderly network RPC - Set
TENDERLY_API_KEYto be able to run e2e tests against forked network
The Governance portal includes two test suites: Vitest and E2E
To run e2e, TENDERLY_API_KEY and NEXT_PUBLIC_TENDERLY_RPC_KEY must be correcly configured.
Install playwright
pnpm playwright install
To run headless mode:
pnpm e2e
To run in UI mode:
pnpm dev:mock to run the app with mock wallet
pnpm e2e:ui to open playwright UI
Vitest tests under the folder __tests__ currently execute unit tests of the platform.
Vitest:
# runs Vitest tests on live-reload mode
npm run test
# runs all the Vitest tests
npm run test:ciThe CI/CD system is integrated with Github Actions.
After each push the system will execute:
-
Lint, verify type consistency
-
Unit test, execute Vitest test suite
npm run start:ciSee our contributing guide.
