Package Logo
meteora-comprehensive
meteora-comprehensive@v2.0.0
Total Downloads
98
Published
yesterday
Network
solana solana
Publisher
User Avatar PaulieB14

Readme

Meteora Substreams

Real-time analytics for Meteora protocol on Solana — covering DLMM (Dynamic Liquidity Market Maker) and Dynamic AMM.

v2.0.0 — Complete rewrite with proper 8-byte Anchor instruction discriminators, state stores, aggregated analytics, and PostgreSQL SQL sink.

What It Tracks

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

Category DLMM Instructions Dynamic AMM Instructions
Swaps swap, swap_exact_out, swap_with_price_impact swap
Liquidity Adds add_liquidity, add_liquidity_by_weight, add_liquidity_by_strategy, add_liquidity_by_strategy_one_side, add_liquidity_one_side add_balance_liquidity, add_imbalance_liquidity, bootstrap_liquidity
Liquidity Removes remove_liquidity, remove_all_liquidity, remove_liquidity_by_range, remove_liquidity_single_side remove_balance_liquidity, remove_liquidity_single_side
Fee Claims claim_fee, claim_reward claim_fee, partner_claim_fee
Pool Creations initialize_lb_pair, initialize_position, initialize_position_pda initialize_permissioned_pool, initialize_permissionless_pool, + 4 more variants

Programs Indexed

Program Address Type
DLMM LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo Concentrated liquidity with bins
Dynamic AMM Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB Constant product + stable swap

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

Module Kind Description
map_meteora_events Map Classifies all DLMM + Dynamic AMM instructions using Anchor discriminators
store_pool_swap_count Store Swap count per pool
store_pool_add_count Store Liquidity add count per pool
store_pool_remove_count Store Liquidity remove count per pool
store_pool_fee_count Store Fee claim count per pool
store_user_swap_count Store Swap count per user
store_user_liquidity_count Store Liquidity op count per user
store_user_fee_count Store Fee claim count per user
store_first_seen Store First-seen timestamp per pool and user
map_pool_stats Map Aggregated pool statistics
map_user_stats Map Aggregated user statistics
db_out Map PostgreSQL database changes

Quick Start

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

# GUI mode
substreams gui meteora-substreams@v2.0.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.0.0.spkg \
  -e mainnet.sol.streamingfast.io:443

SQL Output

Tables

Table Key Description
swaps tx_id-instruction_index Every swap with pool, user, program, instruction type
liquidity_changes tx_id-instruction_index Add/remove liquidity with direction flag
fee_claims tx_id-instruction_index Fee and reward claims
pool_creations tx_id-instruction_index New pool/position initialization
pools pool_address Aggregated: total swaps, adds, removes, fee claims
users user_address Aggregated: total swaps, liquidity ops, fee claims

Views

View Description
top_pools Pools ranked by swap count
top_users Users ranked by swap count
daily_stats Daily swap count, active pools, unique users, DLMM vs AMM breakdown
recent_swaps Latest 100 swaps

Sample Output (200 blocks from slot 310M)

Instruction Count
swap 56
claim_fee 48
add_liquidity_by_strategy 33
initialize_position 29
remove_liquidity_by_range 20
initialize_lb_pair 1
Total 187

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

Documentation

Modules

Maps icon
Maps

map
map_meteora_events

382cc163604600514dcc607aed1402f8d208f990
map map_meteora_events (
blocksf.solana.type.v1.Block
)  -> meteora.v1.MeteoraEvents

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.

substreams gui meteora-comprehensive@v2.0.0 map_meteora_events

map
map_pool_stats

adf56fb9e3cd55cf1688ba1628bb6802964e64f6
map map_pool_stats (
store_pool_swap_countDELTAS<add,int64>
store_pool_add_countGET<add,int64>
store_pool_fee_countGET<add,int64>
store_first_seenGET<set_if_not_exists,int64>
)  -> meteora.v1.PoolStats

Computes aggregated pool statistics.

substreams gui meteora-comprehensive@v2.0.0 map_pool_stats

map
map_user_stats

1a6b79093a5959067023d6267b1b2f285b3e4488
map map_user_stats (
store_user_swap_countDELTAS<add,int64>
store_user_fee_countGET<add,int64>
store_first_seenGET<set_if_not_exists,int64>
)  -> meteora.v1.UserStats

Computes aggregated user statistics.

substreams gui meteora-comprehensive@v2.0.0 map_user_stats

map
db_out

6362935662b6aaa4ed7df266fc637f90e74e4a1e

Outputs database changes for PostgreSQL sink.

substreams gui meteora-comprehensive@v2.0.0 db_out
Stores icon
Stores

store
store_pool_swap_count

6d7dd4391a22d6faf8f190306927716ef9214384
store <add,int64> store_pool_swap_count (
)

Counts total swaps per pool address.

substreams gui meteora-comprehensive@v2.0.0 store_pool_swap_count

store
store_pool_add_count

da57e9565a42ddc6e203e003d1837b1c6504df7b
store <add,int64> store_pool_add_count (
)

Counts liquidity additions per pool.

substreams gui meteora-comprehensive@v2.0.0 store_pool_add_count

store
store_pool_remove_count

65ac9814c1f3076741668f0b40462bf94c442155
store <add,int64> store_pool_remove_count (
)

Counts liquidity removals per pool.

substreams gui meteora-comprehensive@v2.0.0 store_pool_remove_count

store
store_pool_fee_count

d1379026806dbcb7a0a884d2429330ebf898b8ca
store <add,int64> store_pool_fee_count (
)

Counts fee/reward claims per pool.

substreams gui meteora-comprehensive@v2.0.0 store_pool_fee_count

store
store_user_swap_count

1820b368dace48c7a20216308f83393045ac72f5
store <add,int64> store_user_swap_count (
)

Counts total swaps per user.

substreams gui meteora-comprehensive@v2.0.0 store_user_swap_count

store
store_user_liquidity_count

bcea4e17d983633499d19cf428375bb9c70d630d
store <add,int64> store_user_liquidity_count (
)

Counts total liquidity ops per user.

substreams gui meteora-comprehensive@v2.0.0 store_user_liquidity_count

store
store_user_fee_count

9ce771fcfa38e62797309b8ba691499aa86b452f
store <add,int64> store_user_fee_count (
)

Counts total fee claims per user.

substreams gui meteora-comprehensive@v2.0.0 store_user_fee_count

store
store_first_seen

1cb2bbd9a357281d2e05e89c0862a1186cd24eb8
store <set_if_not_exists,int64> store_first_seen (
)

Records first-seen timestamp per pool and user.

substreams gui meteora-comprehensive@v2.0.0 store_first_seen
Protobuf

Protobuf Docs Explorer

meteora.v1