This mono-repo includes a set of sub-repos that are in charge of different parts of the whole Aragon Court backend:
app
: This repo provides a React app as the frontend app of the Aragon Court backendcli
: This repo provides a CLI tool with a set of commands to interact with an Aragon Court instance.server
: This repo provides the backend server in charge of setting up a database and exposing a set of endpoints that will complement the functionality exposed by the smart contracts.services
: This repo provides a set of background workers in charge of maintaining those things that could be done automatically for Aragon Court.shared
: This repo provides a set of components shared among all the sub-repos of this mono-repo.
To understand better about these repos, you will find detailed information about them on their own READMEs. However, you can follow the following guide to understand you to set up everything locally:
To test Aragon Court locally please do the following tasks:
First, make sure you have both Ganache and Graph CLIs
npm install -g ganache-cli
npm install -g @graphprotocol/graph-cli
Start a local ganache in a separate terminal with the following params:
ganache-cli -h 0.0.0.0 -i 15 --gasLimit 8000000 --deterministic
In another terminal, clone the graph node and start it:
git clone https://github.com/graphprotocol/graph-node/
cd graph-node/docker
npm i
rm -rf data
docker-compose up
If docker prompts you with the error
The reorg threshold 50 is larger than the size of the chain 7, you probably want to set the ETHEREUM_REORG_THRESHOLD environment variable to 0
, simply add a new env variable indocker-compose.yml
namedETHEREUM_REORG_THRESHOLD
assigning it to 0 and start it again.
To deploy a local instance run the following commands on a separate terminal:
git clone https://github.com/aragon/aragon-network-deploy/
cd aragon-network-deploy
npm i
npm run deploy:court:rpc
You can use the provided deployment script to create a manifest file with the providing the court deployed address as follows:
NETWORK=rpc COURT=<COURT_ADDRESS> ./scripts/deploy
You can use Aragon Court's backend CLI to start playing with your deployed instance. First, open a separate terminal, clone this repo and install dependencies:
git clone https://github.com/aragonone/court-backend/
cd court-backend
npm i
npx lerna bootstrap
Finally, make sure you set the local court address in packages/shared/truffle-config.js
.
You can now start playing with the available CLI commands:
mint
: Mint ANJ or Fee tokens for a certain addressheartbeat
: Transition Court termsconfig
: Change Court configstake
: Stake ANJ tokens for a jurorunstake
: Unstake ANJ tokensactivate
: Activate ANJ to the Courtdeactivate
: Deactivate ANJ from the Courtdonate
: Donate funds to Court jurorsarbitrable
: Create new Arbitrable instance for the Courtsubscribe
: Subscribe Arbitrable instance to the Courtdispute
: Create dispute submitting evidencedraft
: Draft dispute and close evidence submission period if necessarycommit
: Commit vote for a dispute roundreveal
: Reveal committed voteappeal
: Appeal dispute in favour of a certain outcomeconfirm-appeal
: Confirm an existing appeal for a disputesettle-round
: Settle penalties and appeals for a disputesettle-juror
: Settle juror for a disputeexecute
: Execute ruling for a dispute
You can also use the rpc:setup
NPM command to populate your local Aragon Court instance with jurors and disputes.
First make sure to create your own .env
file, feel free to follow the template provided in .env.sample
.
Docker setup also includes a Grafana dashboard for logs and metrics, which requires a docker plugin:
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
Finally, spin up docker containers with:
docker-compose up --build -d
- App is available at http://localhost:3000
- Grafana dashboard is available at http://localhost:5000
In order to update the dashboard, click Ctrl+S
> Copy JSON to clipboard
and overwrite the file in monitoring/grafana/provisioning/dashboards/court-backend.json
. Additional dashboards can also be added to the dashboards
folder in JSON format.
You don't need to build the docker container every time. If you had run it before, make sure to remove it first:
docker-compose down