Skip to content

thebadge/thebadge-subgraph

Repository files navigation

TheBadge DApp Subgraph

Join to Discord contributions welcome Follow us on Twitter MIT licensed Latest release

For questions or request information reach out via Discord.

Setup

This document describes how to setup your local working environment in order to develop Messari subgraphs.

Prerequisites

  • Node & npm
  • Some development experience
  • Technical knowledge of blockchains (especially evm)
  • Knowledge of The Graph (our beginner RESOURCES.md file will be a good starting place)

Installation

After installing Nodejs and npm you are close to done with installing all of the development dependencies. There are a few other npm packages to install globally:

This is really all that you need, but you can read more about The Graph packages here.

After cloning the repo and moving into the head of the repository you should install the project-level npm packages:

git clone https://github.com/thebadge/thebadge-subgraph.git
yarn install

Style Guide

In general we follow Google's styling guide as best we can. A few pointers to get you started:

  • Always opt for const over let unless you have to change the value of the variable.
  • Use constants when you are hardcoding a value and use CONSTANT_CASE.
  • Otherwise, most variables should be in camelCase
  • File names should be in camelCase and we try to keep folder names to one word if possible.
  • To make your code more readable use early returns when things go wrong.
  • When making a contract call you should always your try...reverted pattern outlined here.

What is next?

From here you should be set to build, run, but what about deploy?

Authenticate with TheGraph

  1. First authenticate to TheGraph:

Configure your .env file: THE_GRAPH_DEV_TESTING_AUTH_TOKEN

# Run the following
$ yarn auth
  1. Then you can do
# development
$ yarn codegen
$ yarn build
$ yarn deploy:dev

Want to learn more?

You can learn more reading docs