All packages
pancakeswap_v2

pancakeswap_v2

Supeeerpower
v0.1.2/10 downloads/Repository

Package ref

pancakeswap-v2@v0.1.2

Run package

CLI

Run map_v2_events from the command line.

substreams run pancakeswap-v2@v0.1.2 map_v2_events -e bsc
Authenticate by running substreams auth or directly on thegraph.market (see docs).

README

pancakeswap_v2

PancakeSwap V2 PairCreated and Sync events on BSC mainnet.

Overview

This Substreams package indexes PancakeSwap V2 on BNB Smart Chain (BSC) from factory deployment (block 586,851):

  • PairCreated — every new pool from the official factory (0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73)
  • Sync — reserve updates on all PancakeSwap V2 factory pairs (full historical backfill)

store_pairs builds the set of factory pair addresses as PairCreated events are processed; Sync logs are decoded for any address in that set. Other V2 forks on BSC are excluded.

Block-level filtering via ethereum-common skips blocks with no factory or Sync activity.

Modules

ModuleKindOutputDescription
map_pair_createdmappancakeswap.v2.PairCreatedEventsPairCreated from the factory
store_pairsstorePair addresses seen since block 586,851
map_v2_eventsmappancakeswap.v2.V2EventsPairCreated + Sync for all factory pairs

Prerequisites

  • Substreams CLI
  • buf (used by substreams build for packaging)
  • Rust with wasm32-unknown-unknown target (rustup target add wasm32-unknown-unknown)
  • BSC endpoint auth — run substreams auth or set SUBSTREAMS_API_KEY

Quick Start

substreams build

# Test around factory deployment
substreams run substreams.yaml map_v2_events \
  -e bnb.streamingfast.io:443 \
  -s 586851 -t +1000 \
  -o jsonl

# Full backfill (use production mode + disable block limit for large ranges)
substreams run substreams.yaml map_v2_events \
  -e bnb.streamingfast.io:443 \
  -s 586851 -t 0 \
  --limit-processed-blocks 0 \
  --production-mode \
  -o jsonl

Factory address

ContractBSC mainnet
PancakeSwap V2 Factory0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73

Modules

Execution graph

5 modules
store

store_pairs

Tracks every pair address created by the PancakeSwap V2 factory.

from #586851

Store value

bytes

Update policy

set_if_not_exists

Show 2 dependencies
map

eth_common:all_events

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

Output

sf.substreams.ethereum.v1.Events

blockIndex

eth_common:index_events

`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)

Output

sf.substreams.index.v1.Keys