🦀 Ocean Protocol Subgraph
Go to file
ssallam 61238ab624 update README file. 2020-12-09 15:03:40 +01:00
abis update consume price and use pool contract call. 2020-12-08 13:32:15 +01:00
src/mappings update README file. 2020-12-09 15:03:40 +01:00
.gitattributes Add mappings for BFactory and BPool events with handlers 2020-11-20 13:12:02 +01:00
.gitignore Add mappings for BFactory and BPool events with handlers 2020-11-20 13:12:02 +01:00
LICENSE Initial commit 2020-11-19 08:15:23 +01:00
README.md update README file. 2020-12-09 15:03:40 +01:00
package-lock.json update schema to support pool reserve/price history and data token transaction history and balance history. 2020-12-02 11:07:09 +01:00
package.json update schema to support pool reserve/price history and data token transaction history and balance history. 2020-12-02 11:07:09 +01:00
schema.graphql add pool transaction count, update pool reserves correctly, prevent div-by-zero errors. 2020-12-09 11:54:13 +01:00
subgraph.yaml update consume price and use pool contract call. 2020-12-08 13:32:15 +01:00
tsconfig.json update README file. 2020-12-09 15:03:40 +01:00

README.md

Ocean Protocol Subgraph

Running locally

  • Install Graph CLI globally with npm
npm install -g @graphprotocol/graph-cli
  • Install/run the Graph: https://thegraph.com/docs/quick-start
    • You can skip running ganache-cli and connect directly to mainnet using Infura
git clone https://github.com/graphprotocol/graph-node/
cd graph-node/docker
./setup.sh
# Update this line in the `docker-compose.yml` file with your Infura ProjectId
#   ethereum: 'mainnet:https://mainnet.infura.io/v3/INFURA_PROJECT_ID'
docker-compose up

Note: making contract calls using Infura fails with missing trie node errors. The fix requires editing ethereum_adapter.rs line 434 to use the latest block instead of a specific block number. Replace: web3.eth().call(req, Some(block_id)).then(|result| { with web3.eth().call(req, Some(BlockNumber::Latest.into())).then(|result| {

To run the graph-node with this fix it must be run from source.

First, delete the graph-node container from the docker-compose.yml file then run docker-compose up to get the postgresql and ipfs services running.

Now you can build and run the graph-node from source

cargo run -p graph-node --release > graphnode.log --   
  --postgres-url postgres://graph-node:let-me-in@localhost:5432/graph-node   
  --ethereum-rpc mainnet:https://mainnet.infura.io/v3/INFURA_PROJECT_ID   
  --ipfs 127.0.0.1:5001
  • Once the graph node is ready, do the following to deploy the ocean-subgraph to the local graph-node
git clone https://github.com/oceanprotocol/ocean-subgraph/
cd ocean-subgraph
npm i
npm run codegen
npm run create:local
npm run deploy:local

  • You can edit the event handler code and then run npm run deploy:local
    • Running deploy will fail if the code has no changes
    • Sometimes deploy will fail no matter what, in this case:
      • Stop the docker-compose run (docker-compose down)
      • Delete the ipfs and postgres folders in graph-node/docker/data
      • Restart docker-compose
      • Run npm run create:local to create the ocean-subgraph
      • Run npm run deploy:local to deploy the ocean-subgraph