Package Logo
base-orderbook
base-orderbook@v0.1.1
Total Downloads
3
Published
3 hours ago
Network
base base
Publisher
User Avatar SC4RECOIN

Readme

Substreams

Substreams is an indexer for onchain events when subgraphs aren't available.

https://docs.substreams.dev

Deploy subgraph

Each chain has its own configuration file. See the justfile for deployment commands.

Example: Sepolia

  1. Copy an existing configuration file and rename it to substreams-sepolia.yaml
  2. Update the package name field in the config to name: sepolia-orderbook
  3. Update the starting block initialBlock: 10108380
  4. Update the parameter field to the appropriate chain id to map_evm_events: "11155111"
  5. Update the neywork field to network: sepolia
  6. Build and publish the spkg file with just build-and-publish-evm sepolia
  7. Deploy an indexing service using the docker image specified in the justfile
  8. Set PACKAGE env variable to sepolia-orderbook-v0.1.1.spkg
  9. Test with just debug-gui sepolia 10108380 (next 10 block should have events)

Documentation

Modules

Maps icon
Maps

map
map_evm_events

2a50bb22619ed4850bba1deb81842f941e2f50c7
map map_evm_events (
paramsstring
blocksf.ethereum.type.v2.Block
)  -> substreams.v1.program.Data
Default param : 8453
substreams gui base-orderbook@v0.1.1 map_evm_events

map
ethcommon:all_events

433686393b184c57628660f7dbe6cfed4d72a9e9
map ethcommon:all_events (
)  -> sf.substreams.ethereum.v1.Events

all_events gives you all the events in a block (from successful transactions), with basic block hash/number/timestamp and transaction hash

substreams gui base-orderbook@v0.1.1 ethcommon:all_events
Block Indexes icon
Block Indexes

blockIndex
ethcommon:index_events

8375ddd2cb44363ab1691748ecb6303603f29568

index_events sets the following keys on the block:

  • Event signatures evt_sig:0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef (signature in hex, prefixed by 0x)
  • Event address evt_addr:0x0123456789abcdef0123456789abcdef01234567 (address in hex, prefixed by 0x)
substreams gui base-orderbook@v0.1.1 ethcommon:index_events
Protobuf

Protobuf Docs Explorer

sf.ethereum.transform.v1
sf.ethereum.type.v2
schema
substreams.v1.program
sf.ethereum.substreams.v1