Code Monkey home page Code Monkey logo

scoutxsubgraph's Introduction

Prerequisite

Install Ganache-Cli

npm i -g ganache-cli

Install Yarn

brew install yarn

Install Graph

# NPM
npm install -g @graphprotocol/graph-cli

Docker Node

Installing and Running

Step 1

Clone this repo

git clone https://github.com/kushalbery/admin_subgraph.git

Step 2

Run Ganache-Cli

ganache-cli -h 0.0.0.0 -d -l=15000000

Step 3

Clone and Run local graph node

docker-compose up

Step 4

Install npm packges

npm i

Step 5

Run subgraph

chmod +x ./start.sh
./start.sh

Query

  • Players

    {
        players(first: 1000) {
          id
          currentLongTokenPrice
          currentShortTokenPrice
          questionId
          trade(where: { timestamp_lt: "1647450015" }, first: 1, orderBy: timestamp, orderDirection: desc) {
            id
            longTokenPrice
            shortTokenPrice
            timestamp
            questionId
            fpmm {
              id
            }
          }
        }
      }
    Replace timestamp_lt value
  • User Profit & Loss Data

      query getUserPnl {
        userPlayerHoldings(where :{userId : "0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1"}, subgraphError:allow){
          questionId
          tours{
            id
            userId
            questionId
            investmentAmount
            fpmmId
            outcomeIndex
            tokens
            player{
              currentLongTokenPrice
              currentShortTokenPrice
            }
          }
        }
      }
    

    Replace userId

Debug

  • In case of your graph-node exit with admin_subgraph_graph-node_1 exited with code 137 try restarting the graph-node container
  • To delete your old containers
    • docker rm $(docker ps -a -q)

To be reviewed

  • event Transfer in FPMM

scoutxsubgraph's People

Contributors

jagdishcm-sixer avatar kushgupta18 avatar

Watchers

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