Package Logo
clanker_substreams
clanker_substreams@v0.2.0
Total Downloads
6
Published
10 hours ago
Network
base base
Publisher
User Avatar PaulieB14

Readme

Clanker Substreams

High-performance blockchain indexer for Clanker token factory on Base, built with Substreams.

What is Clanker?

Clanker is a set of audited smart contracts on Base that create token markets rewarding token creators. Tokens are deployed via Farcaster, web interface, SDK, or direct contract interaction.

What This Indexes

  • Token Launches - All new Clanker tokens with full metadata
  • Fee Claims - Creator and team reward distributions
  • Extensions - Airdrop, presale, and other extension triggers
  • Metadata Updates - Token image and metadata changes
  • Verifications - Token verification events
  • Transfers - ERC20 transfers for all Clanker tokens

Prerequisites

Quick Start

1. Install Dependencies

# Install Rust wasm target
rustup target add wasm32-unknown-unknown

# Install substreams CLI (macOS)
brew install streamingfast/tap/substreams

# Authenticate
substreams auth

2. Build

# Generate protobuf code and compile to WASM
substreams build

3. Run

# Test with a small block range
substreams run -e base map_clanker_events -s 22520000 -t +1000

# Run with JSON output
substreams run -e base map_clanker_events -s 22520000 -t +1000 -o jsonl

4. Deploy to SQL Database

# Create the database tables
psql -d your_database -f schema.sql

# Run the SQL sink
substreams-sink-sql run \
  base \
  "postgresql://user:pass@localhost:5432/clanker?sslmode=disable" \
  substreams.yaml \
  db_out

Modules

Module Type Description
map_clanker_events Map Extracts factory events (TokenCreated, FeeClaims, etc.)
store_tokens Store Maintains registry of all Clanker tokens
map_token_transfers Map ERC20 transfers for known Clanker tokens
store_token_volume Store Accumulates transfer volume per token (BigInt)
store_token_transfer_counts Store Tracks transfer counts per token
store_creator_fees Store Accumulates fees claimed per creator
store_creator_token_counts Store Counts tokens launched per creator
db_out Map Database sink output (PostgreSQL/ClickHouse)

Configuration

The Clanker factory address can be configured via params:

substreams run -e base map_clanker_events \
  -p map_clanker_events="clanker_factory=0xe85a59c628f7d27878aceb4bf3b35733630083a9" \
  -s 22520000 -t +1000

Contract Addresses (Base v4)

Contract Address
Clanker Factory (v4) 0xE85A59c628F7d27878ACeB4bf3b35733630083a9

Project Structure

clanker-substreams/
├── substreams.yaml          # Manifest
├── schema.sql               # SQL schema for sink
├── Cargo.toml               # Rust dependencies
├── build.rs                 # ABI code generation
├── clanker.jpeg             # Package icon
├── abi/
│   ├── clanker_factory.json # Factory ABI
│   └── clanker_token.json   # Token ABI
├── proto/
│   └── clanker.proto        # Protobuf schemas
└── src/
    ├── lib.rs               # Module implementations
    ├── abi/
    │   └── mod.rs           # Generated ABI bindings
    └── pb/                  # Generated protobuf code (auto)

Example Queries

Get all tokens launched in last 24 hours

SELECT name, symbol, admin, block_timestamp
FROM tokens
WHERE block_timestamp > EXTRACT(EPOCH FROM NOW() - INTERVAL '24 hours')
ORDER BY block_timestamp DESC;

Get top creators by token count

SELECT admin, COUNT(*) as token_count
FROM tokens
GROUP BY admin
ORDER BY token_count DESC
LIMIT 20;

Get fee claims for a token

SELECT recipient, amount, block_timestamp
FROM fee_claims
WHERE token = '0x...'
ORDER BY block_timestamp DESC;

Resources

License

MIT

Documentation

Modules

Maps icon
Maps

map
map_clanker_events

6bf0cc2ac708a13fe8a3de79dc064e4cfcc02843
map map_clanker_events (
paramsstring
blocksf.ethereum.type.v2.Block
)  -> clanker.v1.ClankerEvents
Default param : clanker_factory=0xe85a59c628f7d27878aceb4bf3b35733630083a9
substreams gui clanker-substreams@v0.2.0 map_clanker_events

map
map_token_transfers

6b69a3ea910a93cfeecec49393300e29bbd28fe8
substreams gui clanker-substreams@v0.2.0 map_token_transfers

map
db_out

a34f5a142f25dba10d3d146461a4d0bff7056418
substreams gui clanker-substreams@v0.2.0 db_out
Stores icon
Stores

store
store_tokens

9e4b5463895181609ed1bd95b07b9eea1d379322
substreams gui clanker-substreams@v0.2.0 store_tokens

store
store_token_volume

f4ed63fb6d785d2600a8bba31e734ff24347a79e
store <add,bigint> store_token_volume (
)
substreams gui clanker-substreams@v0.2.0 store_token_volume

store
store_token_transfer_counts

03fdb436dee967d84ae56b2b48f7aa99c731b405
store <add,int64> store_token_transfer_counts (
)
substreams gui clanker-substreams@v0.2.0 store_token_transfer_counts

store
store_creator_fees

af0bad011dcad2eefa8ebf9628210fc1e3862f85
store <add,bigint> store_creator_fees (
)
substreams gui clanker-substreams@v0.2.0 store_creator_fees

store
store_creator_token_counts

8aeb2f927c9565fa7354ce656dcbb3219ee04dc6
store <add,int64> store_creator_token_counts (
)
substreams gui clanker-substreams@v0.2.0 store_creator_token_counts
Protobuf

Protobuf Docs Explorer

sf.ethereum.substreams.v1
sf.ethereum.type.v2
sf.ethereum.transform.v1
clanker.v1