Git Product home page Git Product logo

renprotocol-renvm-subgraph's Introduction

Subgraph

RenVM Subgraph

Currently deployed at

Examples

Send a QUERY with cURL:

Shell command:

curl \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{ "query": "{ transactions { id, amount } }" }' \
  https://api.thegraph.com/subgraphs/name/renproject/renvm

Get daily BTC volume

GraphQL query:

{
    renVM(id: 1) {
        volume {
            symbol
            amountInUsd
        }
    }
    epoches(first: 5, orderBy: timestamp, orderDirection: desc) {
        numberOfDarknodes
        rewardShares {
            symbol
            amountInUsd
        }
    }
}

Developing locally

To setup the graph node, follow the instructions at https://thegraph.com/docs/quick-start.

Some things to note:

  1. Pass -d to ganache-cli so generate contracts with the same addresses as config/ganache.json.
  2. If you restart ganache-cli, you may have to run sudo rm -r data/postgres in the graph-node/docker directory.

Once everything is set-up, restarting will look like:

# In darknode-sol
yarn
yarn ganache-cli -h 0.0.0.0 -d
# In a different terminal
yarn truffle migrate

# In graph-node
cd docker
sudo rm -rf data/postgres
./setup.sh # (may have to update docker-compose.yml manually, replace ethereum address with `host.docker.internal` or correct IP)
docker-compose up

# In renvm-subgraph
yarn
yarn create:local
yarn deploy:local

Deploying to thegraph.com

Authorize, using the AUTH_CODE found in your thegraph.com account:

graph auth https://api.thegraph.com/deploy/ <AUTH_CODE>

Then run one of:

yarn deploy:mainnet
yarn deploy:testnet
yarn deploy:devnet

Note: only run one deployment at a time, as they all have to generate ./src/_config.ts with values specific to the network.

renprotocol-renvm-subgraph's People

Contributors

0x31 avatar amcassetti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.