/graph-network-substreams

Graph Network Substreams

Primary LanguageRustApache License 2.0Apache-2.0

Graph Network Subgraph fed by Substreams

Substreams based Graph Network subgraph and substreams.

License

Introduction

This project is a subgraph fed by substreams that allows you to obtain data for The Graph Network.

Features

Available Data

This subgraph makes available the following data:

  • Total supply, total mints and burns of GRT,
  • GRT balances of addresses
  • In-protocol balances like indexer, delegator and curator stakes

Substreams Module Graph

Here is the graph of the modules of the substreams:

graph LR;
  map_storage_changes[map: map_storage_changes];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_storage_changes;
  map_events[map: map_events];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_events;
  map_indexing_rewards[map: map_indexing_rewards];
  map_storage_changes --> map_indexing_rewards;
  map_events --> map_indexing_rewards;
  store_subgraph_deployment_id --> map_indexing_rewards;
  store_grt_balances[store: store_grt_balances];
  map_events --> store_grt_balances;
  store_grt_global[store: store_grt_global];
  map_events --> store_grt_global;
  store_staked_tokens[store: store_staked_tokens];
  map_storage_changes --> store_staked_tokens;
  store_graph_account_indexer[store: store_graph_account_indexer];
  map_storage_changes --> store_graph_account_indexer;
  store_graph_account_delegator[store: store_graph_account_delegator];
  map_events --> store_graph_account_delegator;
  store_graph_account_curator[store: store_graph_account_curator];
  map_events --> store_graph_account_curator;
  store_cumulative_delegated_stakes[store: store_cumulative_delegated_stakes];
  map_events --> store_cumulative_delegated_stakes;
  store_cumulative_delegator_stakes[store: store_cumulative_delegator_stakes];
  map_events --> store_cumulative_delegator_stakes;
  store_total_delegated_stakes[store: store_total_delegated_stakes];
  map_storage_changes --> store_total_delegated_stakes;
  store_delegation_parameters[store: store_delegation_parameters];
  map_events --> store_delegation_parameters;
  store_total_signalled[store: store_total_signalled];
  map_storage_changes --> store_total_signalled;
  store_cumulative_curator_signalled[store: store_cumulative_curator_signalled];
  map_events --> store_cumulative_curator_signalled;
  store_subgraph_deployment_id[store: store_subgraph_deployment_id];
  map_events --> store_subgraph_deployment_id;
  store_subgraph_deployment_ipfs_hash[store: store_subgraph_deployment_ipfs_hash];
  map_events --> store_subgraph_deployment_ipfs_hash;
  store_subgraph_deployment_id[store: store_subgraph_deployment_id];
  map_events --> store_subgraph_deployment_id;
  store_cumulative_curator_burned[store: store_cumulative_curator_burned];
  map_events --> store_cumulative_curator_burned;
  store_query_fee_rebates[store: store_query_fee_rebates];
  map_events --> store_query_fee_rebates;
  store_epoch_count --> store_query_fee_rebates;
  store_query_fees_amount[store: store_query_fees_amount];
  map_events --> store_query_fees_amount;
  store_curator_fee_rewards[store: store_curator_fee_rewards];
  map_events --> store_curator_fee_rewards;
  store_curator_rewards[store: store_curator_rewards];
  map_events --> store_curator_rewards;
  store_signal_amount[store: store_signal_amount];
  map_events --> store_signal_amount;
  store_subgraph_deployment_rewards[store: store_subgraph_deployment_rewards];
  map_indexing_rewards --> store_subgraph_deployment_rewards;
  store_epoch_length[store: store_epoch_length];
  map_events --> store_epoch_length;
  store_epoch_count[store: store_epoch_count];
  store_epoch_length --> store_epoch_count;
  sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> store_epoch_count;
  store_epoch_start[store: store_epoch_start];
  store_epoch_count --> store_epoch_start;
  sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> store_epoch_start;
  store_epoch_en[store: store_epoch_end];
  store_epoch_count --> store_epoch_en;
  sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> store_epoch_en;
  store_epoch_signal[store: store_epoch_signal];
  map_storage_changes --> store_epoch_signal;
  store_epoch_count --> store_epoch_signal;
  store_epoch_stake[store: store_epoch_stake];
  map_events --> store_epoch_stake;
  store_epoch_count --> store_epoch_stake;
  store_epoch_rewards[store: store_epoch_rewards];
  map_indexing_rewards --> store_epoch_rewards;
  store_epoch_count --> store_epoch_rewards;
  graph_out[map: graph_out];
  sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> graph_out;
  map_events --> graph_out;
  store_epoch_start -- deltas --> graph_out;
  store_epoch_en -- deltas --> graph_out;
  store_epoch_signal -- deltas --> graph_out;
  store_epoch_stake -- deltas --> graph_out;
  store_epoch_rewards -- deltas --> graph_out;
  store_grt_global -- deltas --> graph_out;
  store_grt_balances -- deltas --> graph_out;
  store_graph_account_indexer -- deltas --> graph_out;
  store_graph_account_delegator -- deltas --> graph_out;
  store_graph_account_curator -- deltas --> graph_out;
  map_storage_changes --> graph_out;
  store_staked_tokens -- deltas --> graph_out;
  store_cumulative_delegated_stakes -- deltas --> graph_out;
  store_cumulative_delegator_stakes -- deltas --> graph_out;
  store_total_delegated_stakes -- deltas --> graph_out;
  store_cumulative_curator_signalled -- deltas --> graph_out;
  store_cumulative_curator_burned -- deltas --> graph_out;
  store_total_signalled -- deltas --> graph_out;
  store_query_fee_rebates -- deltas --> graph_out;
  store_query_fees_amount -- deltas --> graph_out;
  store_curator_fee_rewards -- deltas --> graph_out;
  store_curator_rewards -- deltas --> graph_out;
  store_signal_amount -- deltas --> graph_out;
  store_subgraph_deployment_rewards -- deltas --> graph_out;
  store_subgraph_deployment_ipfs_hash -- deltas --> graph_out;
  map_indexing_rewards --> graph_out;

Loading

Quickstart

To build and run the substream,

  1. Install dependencies.
  2. Get authentication.
  3. Clone this repo
git clone https://github.com/graphops/graph-network-substreams.git
  1. Code gen with
substreams protogen ./substreams.yaml
  1. Build the substream with
cargo build --target wasm32-unknown-unknown --release
  1. Run the graph_out module with
substreams run -e mainnet.eth.streamingfast.io:443 \
substreams.yaml \
graph_out \
--start-block 11446769

Contributing

We welcome and appreciate your contributions! Please see the Contributor Guide, Code Of Conduct and Security Notes for this repository.