All packages

clanker_substreams

PaulieB14
v0.3.0/15 downloads/Repository

Package ref

clanker-substreams@v0.3.0

Run package

CLI

Run db_out from the command line.

substreams run clanker-substreams@v0.3.0 db_out -e base
Authenticate by running substreams auth or directly on thegraph.market (see docs).

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
  • Airdrop Claims - Individual airdrop claims from ClankerAirdropV2
  • MEV Auctions - Auction wins from ClankerSniperAuctionV2

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

ModuleTypeDescription
map_clanker_eventsMapExtracts factory, airdrop, and auction events
store_tokensStoreMaintains registry of all Clanker tokens
map_token_transfersMapERC20 transfers for known Clanker tokens
store_token_volumeStoreAccumulates transfer volume per token (BigInt)
store_token_transfer_countsStoreTracks transfer counts per token
store_creator_feesStoreAccumulates fees claimed per creator
store_creator_token_countsStoreCounts tokens launched per creator
store_airdrop_claims_per_tokenStoreTracks airdrop claim counts per token
store_airdrop_volume_per_tokenStoreAccumulates airdrop volume per token
db_outMapDatabase 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)

ContractAddress
Clanker Factory (v4)0xE85A59c628F7d27878ACeB4bf3b35733630083a9
ClankerAirdropV20xf652B3610D75D81871bf96DB50825d9af28391E0
ClankerSniperAuctionV20xebB25BB797D82CB78E1bc70406b13233c0854413

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

Modules

Execution graph

10 modules
store

store_airdrop_claims_per_token

from #22520000

Store value

int64

Update policy

add

store

store_airdrop_volume_per_token

from #22520000

Store value

bigint

Update policy

add

store

store_creator_fees

from #22520000

Store value

bigint

Update policy

add

store

store_creator_token_counts

from #22520000

Store value

int64

Update policy

add

store

store_token_transfer_counts

from #22520000

Store value

int64

Update policy

add

store

store_token_volume

from #22520000

Store value

bigint

Update policy

add