Install Ganache-Cli
npm i -g ganache-cliInstall Yarn
brew install yarnInstall Graph
# NPM
npm install -g @graphprotocol/graph-cliDocker Node
Clone this repo
git clone https://github.com/kushalbery/admin_subgraph.gitRun Ganache-Cli
ganache-cli -h 0.0.0.0 -d -l=15000000Clone and Run local graph node
docker-compose upInstall npm packges
npm iRun subgraph
chmod +x ./start.sh
./start.sh-
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
- In case of your graph-node exit with
admin_subgraph_graph-node_1 exited with code 137try restarting the graph-node container - To delete your old containers
-
docker rm $(docker ps -a -q)
-
- event Transfer in FPMM