Approval
event, we store each approval record as an entity in our subgraph, then deploy it to Chainstack.false
, and then move your terminal into the directory of your newly created project.
schema.graphql
: this file defines the data sources we actually want to index, and how to query said data.subgraph.yaml
: the subgraph manifest YAML file contains references to the contract ABIs, Graph QL schemas, and assembly script mappings, amongst other things.Subgraph mappings
: mappings define event handlers in charge of managing and storing data on The Graph node.schema.graphql
file and delete everything. Now define a new entity as follows:
subgraph.yaml
and delete everything. Paste the following code inside it.
Approval
event is triggered in the Lido contract. For each event handler that is defined in the subgraph.yaml
, we need to create a handler function in the src/lido.ts
file. This file in each subgraph project is generally referred to as the mappings file.src/lido.ts
and delete everything inside. Now paste the following code inside it:
entity
that has three properties to mirror the emitted data from the approval event. We save this entity using entity.save()
. Also, note that we use the transaction hash and logIndex
to generate a unique ID for all our entities. You can read more about this in The Graph documentation.