-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] FA - 05.06.22 - Proof of concept Subgraph
Feature: - poc against thr Gro Vesting contracts - subgraph indexes relevant events to update a users total Vesting Balance and stores the locked / unlocked vest amounts at that time - This repo serves as a example to build off of Notes: - You can listern to multiple contracts by updating the source in the subgraph.yaml manifest
- Loading branch information
farhaan-ali
committed
Jun 5, 2022
1 parent
83b2e22
commit 481ab97
Showing
8 changed files
with
4,909 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Proof Of Concept Subgraph | ||
|
||
## Background | ||
This repo serves as an example of how to build a subgraph for future reference. This example is used against the GroVesting contract to index and store a users total vesting balance and to give the unlocked/locked values. | ||
|
||
## How to Guide | ||
|
||
The following blog was used to help created this example https://thegraph.academy/developers/defining-a-subgraph/ | ||
|
||
Loose Steps: | ||
|
||
- Create project on subgraph studio | ||
- Using cli initiate project | ||
- Define your entities in the schema | ||
- Update the manifest file to reflect the different listeners you want to have. | ||
- Also update the contracts / start blocks in the manifest | ||
- Run the codegen to get the types generated to use | ||
- Then write your handlers to update the store the entities as you require. | ||
|
||
|
||
## Future Considerations | ||
- You can listern to multiple contracts by updating the manifest datasource in subgraph.yaml | ||
- Make sure to specify the startBlock in the manifest for contracts to sync faster | ||
- If you want to use current data on the DAPP it's always better to read from a contract directly if that value is provided. As you can see in this example the vested balance is stored during the event being triggered and isn't updated to reflect the latest block which can catch people out. |
Oops, something went wrong.