Package Logo
clanker_substreams
clanker_substreams@v0.1.0
Total Downloads
6
Published
9 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=0x20dd04c17afd5c9a8b3f2cdacaa8ee7907385bef" \
  -s 22520000 -t +1000

Contract Addresses (Base v4.1.0)

Contract Address
Clanker Factory 0x20DD04c17AFD5c9a8b3f2cdacaa8Ee7907385BEF
ClankerHookDynamicFeeV2 0xd60D6B218b30aF607a6Fd77dD956F9baC9B50d00
ClankerHookStaticFeeV2 0xb4429d62f8f3bFFb98CdB9574E23499A8ED08Cc
ClankerSniperAuctionV2 0xebB25BB797D82CB78E1bc70406b13233c0854413
ClankerAirdropV2 0xf652B3610D75D81871bf96DB50825d9af28391E0

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

a7fe51af124f957a84863301936ceade72956123
map map_clanker_events (
paramsstring
blocksf.ethereum.type.v2.Block
)  -> clanker.v1.ClankerEvents
Default param : clanker_factory=0x20dd04c17afd5c9a8b3f2cdacaa8ee7907385bef
substreams gui clanker-substreams@v0.1.0 map_clanker_events

map
map_token_transfers

54167160cc33716a76e201c2aff60612ff4206b2
substreams gui clanker-substreams@v0.1.0 map_token_transfers

map
db_out

16aaf9394226fd1b1f735acc18061e68c7a32bd7
substreams gui clanker-substreams@v0.1.0 db_out
Stores icon
Stores

store
store_tokens

ccab5676ae68a9c70dfeb858eea4937705d25a39
substreams gui clanker-substreams@v0.1.0 store_tokens

store
store_token_volume

74269bcb322546811e9effeb7f29d636aae74d1e
store <add,bigint> store_token_volume (
)
substreams gui clanker-substreams@v0.1.0 store_token_volume

store
store_token_transfer_counts

2697e80e7fb4216831d00c4c98167f4c52049d7f
store <add,int64> store_token_transfer_counts (
)
substreams gui clanker-substreams@v0.1.0 store_token_transfer_counts

store
store_creator_fees

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

store
store_creator_token_counts

bdd3edfbf33ad205d181dc0bcc83b6db34eabe9b
store <add,int64> store_creator_token_counts (
)
substreams gui clanker-substreams@v0.1.0 store_creator_token_counts
Protobuf

Protobuf Docs Explorer

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