Install Ganache-Cli
npm i -g ganache-cli
Install Yarn
brew install yarn
Install Graph
# NPM
npm install -g @graphprotocol/graph-cli
Docker Node
Clone this repo
git clone https://github.com/kushalbery/admin_subgraph.git
Run Ganache-Cli
ganache-cli -h 0.0.0.0 -d -l=15000000
Clone and Run local graph node
docker-compose up
Install npm packges
npm i
Run 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 137
try restarting the graph-node container - To delete your old containers
-
docker rm $(docker ps -a -q)
-
- event Transfer in FPMM