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 24 or greater (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/sky-governance-portal.git
# changes directory to cloned project folder
cd sky-governance-portalNext, 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 development, and then merged to main through a PR. To push your local tag use the command git push origin development --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 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 staging data sources (subgraphs and GitHub repos)
-
Set
MIGRATION_WEBHOOK_URLfor sending migration requests to discord -
Set
GASLESS_WEBHOOK_URLfor sending gasless vote requests to discord
Required for gasless voting Set PRIVY_APP_ID, PRIVY_APP_SECRET, and PRIVY_WEBHOOK_SIGNING_SECRET for the Privy server-wallet relayer
Required for gasless voting Set PRIVY_WALLET_ID_MAINNET and/or PRIVY_WALLET_ID_TESTNET to the Privy wallet id used to sign gasless poll votes
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
TENDERLY_API_KEYto be able to run e2e tests against forked network - Set
TENDERLY_MAINNET_FORK_VNET_IDto the ID of the Tenderly VNet used as the fork source
The Governance portal includes two test suites: Vitest and E2E
To run e2e, TENDERLY_API_KEY and TENDERLY_MAINNET_FORK_VNET_ID must be correctly 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.
