All packages

meteora-comprehensive

PaulieB14
v2.2.0/18 downloads/Repository

Package ref

meteora-comprehensive@v2.2.0

Run package

CLI

Run db_out from the command line.

substreams run meteora-comprehensive@v2.2.0 db_out -e solana
Authenticate by running substreams auth or directly on thegraph.market (see docs).

README

Meteora Substreams

Real-time analytics for Meteora protocol on Solana — covering DLMM, Dynamic AMM, and DAMM v2.

v2.2.0 — Adds DAMM v2 (cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG) with concentrated liquidity and compounding fee pool support. All three Meteora programs indexed with proper Anchor discriminators and CPI parsing.

What It Tracks

Every Meteora DLMM and Dynamic AMM instruction, classified into four categories:

CategoryDLMM InstructionsDynamic AMM Instructions
Swapsswap, swap_exact_out, swap_with_price_impactswap
Liquidity Addsadd_liquidity, add_liquidity_by_weight, add_liquidity_by_strategy, add_liquidity_by_strategy_one_side, add_liquidity_one_sideadd_balance_liquidity, add_imbalance_liquidity, bootstrap_liquidity
Liquidity Removesremove_liquidity, remove_all_liquidity, remove_liquidity_by_range, remove_liquidity_single_sideremove_balance_liquidity, remove_liquidity_single_side
Fee Claimsclaim_fee, claim_rewardclaim_fee, partner_claim_fee
Pool Creationsinitialize_lb_pair, initialize_position, initialize_position_pdainitialize_permissioned_pool, initialize_permissionless_pool, + 4 more variants

Programs Indexed

ProgramAddressType
DLMMLBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxoConcentrated liquidity with bins
Dynamic AMMEo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaBConstant product + stable swap
DAMM v2cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGGConcentrated liquidity + compounding fees

Architecture

Layer 1: map_meteora_events
  Anchor discriminator decoding → Swap, LiquidityChange, FeeClaim, PoolCreation

Layer 2: State Stores (8 stores)
  pool swap/add/remove/fee counts, user swap/liquidity/fee counts, first-seen timestamps

Layer 3: Analytics
  map_pool_stats → aggregated pool metrics
  map_user_stats → aggregated user metrics

Layer 4: SQL Sink
  db_out → PostgreSQL (swaps, liquidity_changes, fee_claims, pool_creations, pools, users)

Modules

ModuleKindDescription
map_meteora_eventsMapClassifies all DLMM + Dynamic AMM instructions using Anchor discriminators
store_pool_swap_countStoreSwap count per pool
store_pool_add_countStoreLiquidity add count per pool
store_pool_remove_countStoreLiquidity remove count per pool
store_pool_fee_countStoreFee claim count per pool
store_user_swap_countStoreSwap count per user
store_user_liquidity_countStoreLiquidity op count per user
store_user_fee_countStoreFee claim count per user
store_first_seenStoreFirst-seen timestamp per pool and user
map_pool_statsMapAggregated pool statistics
map_user_statsMapAggregated user statistics
db_outMapPostgreSQL database changes

Quick Start

# Stream Meteora events
substreams run meteora-substreams@v2.2.0 map_meteora_events \
  -e mainnet.sol.streamingfast.io:443 \
  -s 310000000 -t +1000

# GUI mode
substreams gui meteora-substreams@v2.2.0 map_meteora_events \
  -e mainnet.sol.streamingfast.io:443 \
  -s 310000000

# Sink to PostgreSQL
substreams-sink-sql run "psql://localhost/meteora" \
  meteora-substreams-v2.2.0.spkg \
  -e mainnet.sol.streamingfast.io:443

SQL Output

Tables

TableKeyDescription
swapstx_id-instruction_indexEvery swap with pool, user, program, instruction type
liquidity_changestx_id-instruction_indexAdd/remove liquidity with direction flag
fee_claimstx_id-instruction_indexFee and reward claims
pool_creationstx_id-instruction_indexNew pool/position initialization
poolspool_addressAggregated: total swaps, adds, removes, fee claims
usersuser_addressAggregated: total swaps, liquidity ops, fee claims

Views

ViewDescription
top_poolsPools ranked by swap count
top_usersUsers ranked by swap count
daily_statsDaily swap count, active pools, unique users, DLMM vs AMM breakdown
recent_swapsLatest 100 swaps

Sample Output (200 blocks from slot 310M)

InstructionCount
swap995
claim_fee53
swap_exact_out47
add_liquidity_by_strategy35
initialize_position31
remove_liquidity_by_range21
add_liquidity_by_weight1
initialize_lb_pair1
Total1,184

Inner Instruction / CPI Support

Most Meteora swap volume goes through aggregators like Jupiter via CPI (Cross-Program Invocation). This Substreams parses both top-level and inner instructions, capturing 6.3x more events than top-level only. Without CPI parsing, ~84% of swap volume is missed.

Anchor Discriminators

Instructions are decoded using proper 8-byte Anchor discriminators (SHA256("global:{instruction_name}")[0..8]), verified against the official Meteora IDLs. This replaces the v1 approach of guessing instruction types from single-byte indices.

Build

git clone https://github.com/PaulieB14/Meteroa-Substreams.git
cd Meteroa-Substreams
substreams build
substreams pack substreams.yaml

Network

  • Chain: Solana
  • Start Block: 245,000,000
  • Endpoint: mainnet.sol.streamingfast.io:443

References

Modules

Execution graph

12 modules
map

map_meteora_events

Extracts all Meteora protocol events from DLMM and Dynamic AMM programs using proper 8-byte Anchor instruction discriminators. Classifies into: swaps, liquidity changes, fee claims, pool creations.

from #245000000
store

store_first_seen

Records first-seen timestamp per pool and user.

from #245000000

Store value

int64

Update policy

set_if_not_exists

store

store_pool_add_count

Counts liquidity additions per pool.

from #245000000

Store value

int64

Update policy

add

store

store_pool_fee_count

Counts fee/reward claims per pool.

from #245000000

Store value

int64

Update policy

add

store

store_pool_remove_count

Counts liquidity removals per pool.

from #245000000

Store value

int64

Update policy

add

store

store_pool_swap_count

Counts total swaps per pool address.

from #245000000

Store value

int64

Update policy

add

store

store_user_fee_count

Counts total fee claims per user.

from #245000000

Store value

int64

Update policy

add

store

store_user_liquidity_count

Counts total liquidity ops per user.

from #245000000

Store value

int64

Update policy

add

store

store_user_swap_count

Counts total swaps per user.

from #245000000

Store value

int64

Update policy

add