Skip to content

Commit

Permalink
[feat] FA - 05.06.22 - Proof of concept Subgraph
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 8 changed files with 4,909 additions and 135 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
build
24 changes: 24 additions & 0 deletions README.md
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.
Loading

0 comments on commit 481ab97

Please sign in to comment.