The governance hub for the Decentraland ecosystem. Create and vote on proposals that help shape the future of the metaverse via the Decentraland DAO (Decentralized Autonomous Organization).
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 v16.14.2
will install node version 16 and the corresponding npm version.
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.
Run npm install
to install all the dependencies needed to run the project.
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 points to a valid database (see how to create one in the 'Database Setup' section)COMMITTEE_ADDRESSES
: list of eth addresses separated by,
that will be able to enact finished proposalsDISCOURSE_API_KEY
: the api key use to publish the proposals on the forumRPC_PROVIDER_URL
: the rpc provider to get the latest block- Snapshot env vars: see snapshot setup
These environment variables are used by the application backend. The environment variables for the frontend are located in src/config/env
.
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_CATALYST=0
GATSBY_VOTING_POWER_TO_PASS_BAN_NAME=0
GATSBY_VOTING_POWER_TO_PASS_POI=0
GATSBY_VOTING_POWER_TO_PASS_POLL=0
Make sure you have Postgres running.
You can create a DB from scratch, or you can use the import-db.sh
script to create a new DB using the development.sql
dump.
bash ./scripts/import-db.sh USERNAME [DATABASE_NAME] [DUMP_FILE]
If no DATABASE_NAME and DUMP_FILE arguments are given, the script will use the default values and create a governance
db using the development.sql
dump.
The CONNECTION_STRING for the default values should look like this:
postgres://postgres:postgres@localhost:5432/governance
To create a DB, run in the terminal
createdb -U YOUR_USER DATABASE_NAME
The default postgres user is postgres
or your username, and the default password is postgres
.
Use your user and password for the connection string variable, it should look like this:
postgres://YOUR_USER:YOUR_PASSWORD@localhost:5432/DATABASE_NAME
Once you have a CONNECTION_STRING
you can set up your database tables using the following command:
npm run migrate up
GATSBY_SNAPSHOT_SPACE
: the snapshot space where the proposals will be publishedSNAPSHOT_PRIVATE_KEY
,GATSBY_SNAPSHOT_ADDRESS
: a pair address/key with permissions to publish at that snapshot space- The configured SNAPSHOT_PROPOSAL_TYPE for the project is 'single-choice', which means each voter may select only one choice. See available voting systems
You are going to need to register an ENS name in the network you'll create the space in. For this purpose, you are going to need ETH / Goerli ETH. Use the faucet to get it:
Then follow instructions on Snapshot
-
DCL Governance uses several strategies:
{ "symbol": "VP (delegated)", "strategies": [ { "name": "erc20-balance-of", "params": { "symbol": "MANA", "address": "0x The address of the token contract on the network you are using", "decimals": 18 } } ], "delegationSpace": "yourEnsName.eth" }
{ "symbol": "LAND", "address": "0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d", "multiplier": 2000 }
{ "symbol": "NAMES", "address": "0x2a187453064356c898cae034eaed119e1663acb8", "multiplier": 100 }
{ "symbol": "ESTATE", "address": "0x959e104e1a4db6317fa58f8295f586e1a978c297", "multiplier": 2000 }
{ "name": "multichain", "graphs": { "137": "https://api.thegraph.com/subgraphs/name/decentraland/blocks-matic-mainnet" }, "symbol": "MANA", "strategies": [ { "name": "erc20-balance-of", "params": { "address": "0x0f5d2fb29fb7d3cfee444a200298f468908cc942", "decimals": 18 }, "network": "1" }, { "name": "erc20-balance-of", "params": { "address": "0xA1c57f48F0Deb89f569dFbE6E2B7f46D33606fD4", "decimals": 18 }, "network": "137" } ] }
If you need MANA for testing you can get it by interacting with the contract on etherscan
Connect your wallet and use the setBalance
method on the Contract -> Write Contract
section
to (address)
is your addressamount (uint256)
is whatever you want. Take into account that1000000000000000000 = 1 MANA
Take into account that the voting power distribution response from snapshot returns an array with each voting power. The order in which each value is returned depends on the order in which strategies are added to the space on the space settings
- WMANA
- LAND
- ESTATE
- MANA
- NAMES
- DELEGATED
- WEARABLE
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
npm run clean
or
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)
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 at 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.