Skip to content

Commit 030a7f0

Browse files
Add Subgraph Composition examples (#1977)
* Adding Subgraph Composition Repos * change links to repos, fix some typos * changeset --------- Co-authored-by: YaroShkvorets <shkvorets@gmail.com>
1 parent 59ad5f0 commit 030a7f0

File tree

5 files changed

+33
-14
lines changed

5 files changed

+33
-14
lines changed

.changeset/plenty-dancers-trade.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': patch
3+
---
4+
5+
Added subgraph composition examples

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "examples/subgraph-composition-example"]
2+
path = examples/subgraph-composition-example
3+
url = https://github.com/isum/subgraph-composition-example.git
4+
[submodule "examples/subgraph-composition-sample-subgraph"]
5+
path = examples/subgraph-composition-sample-subgraph
6+
url = https://github.com/incrypto32/subgraph-composition-sample-subgraph.git

examples/README.md

+20-14
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,49 @@ This section contains several subgraph examples to help you get started with [Th
44

55
## Table of Contents
66

7-
1. **[Aggregations](/examples/aggregations)**
7+
1. **[Aggregations](/examples/aggregations)**
88
This example demonstrates how to aggregate data using block numbers as predictable values. The comments in the schema, subgraph manifest, and mappings provide guidance for implementing custom aggregations.
99

10-
2. **[Arweave Blocks and Transactions](/examples/arweave-blocks-transactions)**
10+
2. **[Arweave Blocks and Transactions](/examples/arweave-blocks-transactions)**
1111
This example indexes blocks, transactions, tags, and POAs on the Arweave blockchain. Please note that it requires `graph-cli` version 0.30.2 or above to build.
1212

13-
3. **[Cosmos Block Filtering](/examples/cosmos-block-filtering)**
13+
3. **[Cosmos Block Filtering](/examples/cosmos-block-filtering)**
1414
This example stores `Block` objects that represent blocks appended to a Cosmos chain, saving only the block number and timestamp to the store.
1515

16-
4. **[Cosmos Osmosis Token Swaps](/examples/cosmos-osmosis-token-swaps)**
16+
4. **[Cosmos Osmosis Token Swaps](/examples/cosmos-osmosis-token-swaps)**
1717
This example stores `TokenSwap` objects that represent token swaps made using the Generalized Automated Market Maker (GAMM) in the Osmosis chain.
1818

19-
5. **[Cosmos Validator Delegations](/examples/cosmos-validator-delegations)**
19+
5. **[Cosmos Validator Delegations](/examples/cosmos-validator-delegations)**
2020
This example stores `Delegation` objects representing validator delegations on a Cosmos chain.
2121

22-
6. **[Cosmos Validator Rewards](/examples/cosmos-validator-rewards)**
22+
6. **[Cosmos Validator Rewards](/examples/cosmos-validator-rewards)**
2323
This example stores `Reward` objects representing rewards received by validators on a Cosmos chain.
2424

25-
7. **[Ethereum Basic Event Handlers](/examples/ethereum-basic-event-handlers)**
25+
7. **[Ethereum Basic Event Handlers](/examples/ethereum-basic-event-handlers)**
2626
This example shows how to handle basic events on the Ethereum blockchain using The Graph. It provides a practical implementation of event handlers, showcasing how to index and query blockchain data.
2727

28-
8. **[Ethereum Gravatar](/examples/ethereum-gravatar)**
28+
8. **[Ethereum Gravatar](/examples/ethereum-gravatar)**
2929
This example indexes data from the Ethereum Gravatar smart contract. Gravatar is a service where users can create and manage globally unique avatars.
3030

31-
9. **[Example Subgraph](/examples/example-subgraph)**
32-
This example shows the structure of a minimal,basic subgraph. It provides a generic setup with a simple contract and schema designed to teach the fundamentals of defining, mapping, and querying subgraph data.
31+
9. **[Example Subgraph](/examples/example-subgraph)**
32+
This example shows the structure of a minimal, basic subgraph. It provides a generic setup with a simple contract and schema designed to teach the fundamentals of defining, mapping, and querying subgraph data.
3333

34-
10. **[Matic Lens Protocol Posts Subgraph](/examples/matic-lens-protocol-posts-subgraph)**
34+
10. **[Matic Lens Protocol Posts Subgraph](/examples/matic-lens-protocol-posts-subgraph)**
3535
This example demonstrates how to index data from the Lens Protocol deployed on the Polygon (Matic) network.
3636

37-
11. **[NEAR Blocks](/examples/near-blocks)**
37+
11. **[NEAR Blocks](/examples/near-blocks)**
3838
This example indexes blockchain data from the NEAR Protocol. It listens to block-related events and stores key data such as block number, timestamp, and hash in a queryable format.
3939

40-
12. **[NEAR Receipts](/examples/near-receipts)**
40+
12. **[NEAR Receipts](/examples/near-receipts)**
4141
This example indexes transaction receipts from the NEAR Protocol. It tracks and stores receipt data such as transaction hash, status, and execution details.
4242

43-
13. **[Substreams Powered Subgraph](/examples/substreams-powered-subgraph)**
43+
13. **[Substreams Powered Subgraph](/examples/substreams-powered-subgraph)**
4444
This example is a basic Substreams-powered subgraph, which includes the Substreams definition. It tracks new contract deployments on Ethereum and demonstrates integration with Graph Node using `substreams_entity_change` types and helpers.
4545

46+
14. **[Subgraph Composition Using Sushiswap v3 Subgraph on Base](https://github.com/incrypto32/subgraph-composition-sample-subgraph)**
47+
This example illustrates how to optimize a Subgraph using Subgraph Composition. It uses a source Subgraph and a dependent Subgraph, where the source Subgraph tracks events from Sushiswap v3 subgraph on Base.
48+
49+
15. **[Subgraph Composition Using Three Source Subgraph](https://github.com/isum/subgraph-composition-example)**
50+
This example shows how to combine three source Subgraphs into one composable Subgraph to efficiently aggregate data.
51+
4652
To learn more about subgraphs, review [subgraphs](https://thegraph.com/docs/en/subgraphs/developing/subgraphs/) on [The Graph docs](https://thegraph.com/docs/en/).

0 commit comments

Comments
 (0)