All packages
supeeerpower-uniswap-v2

supeeerpower-uniswap-v2

Supeeerpower
v0.1.0/0 downloads/Repository

Package ref

supeeerpower-uniswap-v2@v0.1.0

Run package

CLI

Run map_events from the command line.

substreams run supeeerpower-uniswap-v2@v0.1.0 map_events -e mainnet
Authenticate by running substreams auth or directly on thegraph.market (see docs).

README

supeeerpower-uniswap-v2

Uniswap V2 Substreams for Ethereum, BNB Chain, and Base: factory PairCreated events and Sync events on those pairs.

Overview

This package indexes Uniswap V2 from each factory's deployment. It decodes factory PairCreated and Sync events on those pairs, including creates and Sync in the same block. Output is typed protobuf for substreams run / GUI.

Pick the chain with --network mainnet, --network bsc, or --network base.

NetworkFactoryinitialBlock
mainnet0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f10000835
bsc0x8909Dc15e40173Ff4699343b6eB8132c65e18eC636111192
base0x8909Dc15e40173Ff4699343b6eB8132c65e18eC66601915

Modules

NameKindOutputDescription
map_pair_createdmapproto:uniswap.v2.v1.EventsFactory PairCreated events (pair_created).
store_pairsstoreproto:uniswap.v2.v1.PairCreatedPair metadata keyed by pool:<address> for Sync filtering.
map_eventsmapproto:uniswap.v2.v1.EventsPairCreated plus Sync on those pairs, including same-block creates.

Prerequisites

  • Substreams CLI
  • Rust with wasm32-unknown-unknown (rustup target add wasm32-unknown-unknown)
  • A Substreams API key from The Graph Market (substreams auth or SUBSTREAMS_API_KEY)

Quick Start

# Build WASM into ./target (override CARGO_TARGET_DIR if your environment sets it)
CARGO_TARGET_DIR=./target cargo build --target wasm32-unknown-unknown --release
substreams pack

# Ethereum
substreams run substreams.yaml map_events \
  --network mainnet \
  -s 10000835 \
  -t +1000 \
  -o jsonl

# Base
substreams run substreams.yaml map_events \
  --network base \
  -s 6601915 \
  -t +1000 \
  -o jsonl

# BNB Chain
substreams run substreams.yaml map_events \
  --network bsc \
  -s 36111192 \
  -t +1000 \
  -o jsonl

Use map_pair_created to inspect factory creates only. substreams gui substreams.yaml map_events --network mainnet -s 10008355 is useful for browsing decoded events.

First PairCreated is shortly after deployment on each chain: Ethereum around 10008355, Base around 10526493, BNB Chain at 36111192.

Modules

Execution graph

5 modules
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