The governance hub for Decentraland. Create and vote on proposals that help shape the future of the metaverse.
Before you start make sure you have installed:
use node >= 16
If you are starting from scratch and you don't have Node installed in your computer, we recommend using a Node version manager like nvm to install Node.js and npm instead of the Node installer.
nvm install node
will install the latest version of node and npm.
NOTE
If you are using WSL (Windows Subsystem for Linux) as your development environment, clone the repository into the WSL filesystem. If you clone it inside the Windows filesystem, the project will not work.
create a copy of .env.example
and name it as .env.development
cp .env.example .env.development
to know more about this file see the documentation
if you are running this project locally you only need to check the following environment variables:
CONNECTION_STRING
: make sure it is point to a valid databaseCOMMITTEE_ADDRESSES
: list of eth addresses separated by,
that will be able to enact finished proposalsGATSBY_SNAPSHOT_SPACE
: a snapshot space where the proposal will be publishedSNAPSHOT_PRIVATE_KEY
,GATSBY_SNAPSHOT_ADDRESS
: a pair address/key with permissions to publish at that snapshot spaceDISCOURSE_API_KEY
: the api key use to publish the proposals on the forumALCHEMY_API_KEY
: an alchemy api key to check the voting power
The minimum amount of voting power require to pass a proposal of each type it's defined in these variables, if they are not defined or are not numbers 0
will be used instead
GATSBY_VOTING_POWER_TO_PASS_LINKED_WEARABLES=0
GATSBY_VOTING_POWER_TO_PASS_GRANT=0
GATSBY_VOTING_POWER_TO_PASS_CATALYST=0
GATSBY_VOTING_POWER_TO_PASS_BAN_NAME=0
GATSBY_VOTING_POWER_TO_PASS_POI=0
GATSBY_VOTING_POWER_TO_PASS_POLL=0
check if you have postgres installed
brew list
if you don't, install it (don't forget to brew update
)
brew install postgres
start postgresql
brew services start postgresql
you can run this to check if everything is ok
createdb `whoami`
inside psql run create database snapshot
use your user:pwd
for the connection string, it should look like this:
postgres://usr:pwd@localhost:5432/snapshot
If you installed postgres using brew, you might need to create a role for npm to run the migrations To do so, run this in psql
CREATE USER postgres SUPERUSER;
once you have a CONNECTION_STRING
you can setup you database tables using the following command
npm run migrate up
if migrations are not running, or get stuck, please check that you are using node v12
to run the tests you can do
npm test
or create a run configuration in your IDE with jest --no-cache --no-watchman --runInBand
Also, you can try adding the --verbose
option.
The --runInBand
parameter runs the tests in a single thread, which is usually faster, but you can try without it
and see what works best for you.
once you setup this project you can start it using the following command
npm start
Note 1: this project run over
https
, if it is your first time you might need to run it withsudo
Note 2: you can disabled
https
removing the--https
flag in thedevelop
script of yourpackage.json
the app should be running at https://localhost:8000/
To clear cache and update localization and internationalization renders, run
rm -r .cache
You can find a full documentation about the project's structure in the decentraland-gatsby
repository
this project runs gatsby as front-end and a nodejs server as back-end both connected through a proxy
- locally this proxy is defined in
gatsby-config.js
(proxy
prop) - at servers this proxy is defined in
Pulumi.ts
(servicePaths
prop)
front-end routes are defined using gatsby routes + gatsby-plugin-intl, you can find each page in the src/pages
directory
back-end routes are defined using express
you can find each route in src/entities/{Entity}/routes.ts
and those are imported ar src/server.ts
Types and Utils contain functions and types that will be accessible to both the backend and the frontend.
Be careful with what goes in here, because when webpack tries to compile everything for the frontend it won't have all the backend dependencies, which could result in an error (e.g. ERROR #98123 WEBPACK
)
- Proposals are created in pending, and automatically passed to active
- After a voting period of 1 week, they are automatically marked as finished, passed, or rejected, depending on the kind of proposal and of the voting results.
- If proposal is in finished status, a committee user can pass/reject it, with a comment.
- Once passed, a proposal can be enacted by a committee user, with a comment.
- Voting results are calculated in two different ways, for different purposes:
Votes/utils.ts
calculates the results in a user-friendly way, so they can be displayed in the frontend. These results are rounded up for clarity.Proposal/jobs.ts
has a more exact calculation, and is used to evaluate the real result of the voting
This repository is protected with a standard Apache 2 license. See the terms and conditions in the LICENSE file.