maraoz / governance

🏢 Frontend for governance of the Decentraland DAO

Home Page:https://governance.decentraland.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decentraland

# Decentralized Autonomous Organization

The governance hub for Decentraland. Create and vote on proposals that help shape the future of the metaverse.

preview

Setup

Node version

use node 12.22.7

environment setup

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 database
  • COMMITTEE_ADDRESSES: list of eth addresses separated by , that will be able to enact finished proposals
  • GATSBY_SNAPSHOT_SPACE: a snapshot space where the proposal will be published
  • SNAPSHOT_PRIVATE_KEY, GATSBY_SNAPSHOT_ADDRESS: a pair address/key with permissions to publish at that snapshot space
  • DISCOURSE_API_KEY: the api key use to publish the proposals on the forum
  • ALCHEMY_API_KEY: an alchemy api key to check the voting power

setup the required voting power to pass

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_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

database setup

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

user 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

Run Tests

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.

Run

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 with sudo

Note 2: you can disabled https removing the --https flag in the develop script of your package.json

the app should be running at https://localhost:8000/

Clear

To clear cache and update localization and internationalization renders, run

rm -r .cache

Project's structure

You can find a full documentation about the project's structure in the decentraland-gatsby repository

back and front ends

this project runs gatsby as front-end and a nodejs server as back-end both connected through a proxy

routes

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

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)

About proposals statuses

  • 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.

About voting results

  • 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

Copyright & License

This repository is protected with a standard Apache 2 license. See the terms and conditions in the LICENSE file.

About

🏢 Frontend for governance of the Decentraland DAO

https://governance.decentraland.org

License:Other


Languages

Language:TypeScript 88.9%Language:CSS 9.4%Language:JavaScript 1.0%Language:Shell 0.4%Language:Dockerfile 0.2%