Emits PairCreated and Sync events. Sync is decoded for every PancakeSwap V2 factory pair (all pools), not only newly created ones.
Output
pancakeswap.v2.V2EventsPackage ref
pancakeswap-v2@v0.1.2Run package
CLI
Run map_v2_events from the command line.
substreams run pancakeswap-v2@v0.1.2 map_v2_events -e bscsubstreams auth or directly on thegraph.market (see docs).README
PancakeSwap V2 PairCreated and Sync events on BSC mainnet.
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.
| Module | Kind | Output | Description |
|---|---|---|---|
map_pair_created | map | pancakeswap.v2.PairCreatedEvents | PairCreated from the factory |
store_pairs | store | — | Pair addresses seen since block 586,851 |
map_v2_events | map | pancakeswap.v2.V2Events | PairCreated + Sync for all factory pairs |
substreams build for packaging)wasm32-unknown-unknown target (rustup target add wasm32-unknown-unknown)substreams auth or set SUBSTREAMS_API_KEYsubstreams 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
| Contract | BSC mainnet |
|---|---|
| PancakeSwap V2 Factory | 0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73 |
Modules
Emits PairCreated and Sync events. Sync is decoded for every PancakeSwap V2 factory pair (all pools), not only newly created ones.
Output
pancakeswap.v2.V2EventsDecodes PairCreated events from the PancakeSwap V2 factory (from deployment block 586851).
Store value
bytes
Update policy
set_if_not_exists
Inputs
Output
sf.substreams.ethereum.v1.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
Inputs