Developer Highlights #2 - "Building ambitious subgraphs" part 1



For the second Developer Highlights, we get to speak with Sebastian Siemssen & Ivan Herger.

Ivan and Sebastian are long time members and developers in our community and have been working on subgraphs for Enzyme Finance (formerly Melon Protocol) for more than 2 years. They are going to share the challenges they faced and the lessons they learned along the way. In this episode we’ll explore some of the more demanding event tracking, data aggregation and scaling requirements of a DeFi subgraph and the patterns and solutions they came up with to solve them:

  • Dealing with external contracts with non-ideal behavior (incomplete & missing events, etc.)
  • Tips for filtering and paginating large data sets
  • Tips for designing a graphql schema
  • and more …

This is the first of two parts. I also recommend watching the second part.

Watch the full episode, or jump straight to each topic using the timestamps below the video.

00:00​ Episode overview

02:54​ Enzyme Finance - Protocol overview
09:43​ Enzyme Finance - How subgraphs are used
17:06​ Enzyme Finance - How the subgraph performance have increased

19:39​ Smart Contract Design - Write events with data retrieval in mind
23:18​ Smart Contract Design - Upgradable contracts (proxy pattern)

25:40​ Schema Design - Build the schema close to the data Requirements
27:11​ Schema Design - Limitations to filter and sort
30:21​ Schema Design - Low/High level data
32:22​ Schema Design - Upgradable Protocols

33:58​ Pagination - Capabilities and limitations
38:23​ Pagination - Exactly-once Guarantees
40:38​ Pagination - Counting

42:01​ Avoiding Fatal Errors - About
45:03​ Avoiding Fatal Errors - Try/catch
49:25​ Avoiding Fatal Errors - Don’t throw exceptions
51:06​ Avoiding Fatal Errors - nonFatalErrors
54:02​ Avoiding Fatal Errors - Required properties in the schema

55:55​ Mappings - Save/Load performance Impact

00:57:20​ Interfaces - An often missed feature
00:58:40​ Interfaces - Union Types
01:00:45​ Interfaces - Type Field
01:02:41​ Interfaces - Entity Utils

We encourage anyone to ask questions about these topics below.

7 Likes

If Ivan and Sebastian could start all over again with the subgraphs for Enzyme Finance, what would they do differently now? What were the key lessons they’ve learned?

5 Likes

Hi everyone!
We just published the second Developer Highlights!
Ivan Herger & Sebastian Siemssen from Enzyme Finance have been perfecting their subgraphs for 2 years. Both beginners and experienced subgraph developers will have a lot to learn from their journey. In the first part we are looking at

  • Smart contract design
  • Schema design
  • Pagination
  • Avoiding Fatal Errors
  • Interfaces

Watch the full episode, or jump straight to each topic using the timestamps below the video.

5 Likes