What is the proper way to create entities? #1425
Closed
nicolasguasca1
started this conversation in
General
Replies: 1 comment
-
Hey @nicolasguasca1, thanks for trying out subgraphs! Your schema should reflect whatever data it is that you need from your subgraph. If you need to track variables inside the contract, you can create corresponding entities in the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to setup the list of entities I need for my project. My contracts have events for multiple actions that occur inside the functions. Some of these events index the values that belong to structs and the events are used as a way to keep a record on when, what and by who are these struct values updated.
I have designed my entire set of contracts in this way so please let me know if this approach is not correct and why.
Then, take the following example of my project:
I see from The Graph docs that a bad example for entity setting is:
Docs also say that creating entities for every single event is not a good practice. This means that having a "type AdminCreation @entity..." is not a good idea and instead it should be "type Admin @entity..." Correct?
However, when talking about the mappings, this example is presented as valid:
This means that the schema.ts should indeed export the object class that contains the info of the struct (Gravatar) and is mapped taking into account the what the events typed (NewGravatar, UpdatedGravatar) bring.
My questions:
Beta Was this translation helpful? Give feedback.
All reactions