Modules you did not write
Start from an existing package for the protocol instead of decoding it again.
Decoded data
Transactions arrive as the entities your product already talks about, instead of raw events you decode yourself.
StreamingFast
ecosystem
01 Decoded data
Every new contract means a new decoder, written by the person who has the least time.
A proxy was upgraded, the decoder stopped matching, nothing errored, and the chart went flat.
The event decodes correctly and the balance is still wrong.
Turning logs into entities is not a one-off script. It is a layer you version, test and keep correct as contracts change. Substreams packages are that layer, written once and reused: you start from a module that already decodes what you need, and spend your time on the rules that are specific to your product.
Read the guide01 specVersion: v0.1.0
02 package:
03 name: token_transfers
04 version: v0.1.0
05
06 modules:
07 - name: map_transfers
08 kind: map
09 inputs:
10 - source: sf.ethereum.type.v2.Block
11 output:
12 type: proto:transfers.TransfersStart from an existing package for the protocol instead of decoding it again.
Modules feed modules. The output of one is the input of the next.
Map decoded events onto a swap, a position, a holder, whatever your product calls it.
You can read the decoding logic you depend on.
The same stream lands in a database, a file or your own consumer.
02 Decoded data
Find the package that already handles the protocol you care about.
Write only the rules that are yours.
Send it where you consume it, continuously rather than on a schedule.
03 Decoded data
Decoded data
Separate decoding from business logic, preserve event order and make every derived value traceable.