Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Verified Solana examples

These queries are stored under examples/solana/ and executed against the live database during every strict docs build. Each scan is constrained by time or by the newest data window.

Transfer and funding activity

token_transfers and sol_top_ups are intentionally separate helper tables. This query combines their hourly counts without joining individual records. It is adapted from the workflow introduced in Two New Solana Tables: token_transfers and sol_top_ups.

WITH
    toStartOfHour(now()) AS end_hour,
    end_hour - INTERVAL 24 HOUR AS start_hour
SELECT
    hour,
    sum(token_transfers) AS token_transfers,
    sum(sol_top_ups) AS sol_top_ups
FROM
(
    SELECT toStartOfHour(block_time) AS hour,
           count() AS token_transfers, 0 AS sol_top_ups
    FROM token_transfers
    PREWHERE block_time >= start_hour AND block_time < end_hour
    GROUP BY hour
 
    UNION ALL
 
    SELECT toStartOfHour(block_time) AS hour,
           0 AS token_transfers, count() AS sol_top_ups
    FROM sol_top_ups
    PREWHERE block_time >= start_hour AND block_time < end_hour
    GROUP BY hour
)
GROUP BY hour
ORDER BY hour

Source: examples/solana/transfer_activity.sql.

PumpSwap reserve and fee reconciliation

PumpSwap rows expose before/after pool reserves, exact-quote mode, virtual quote reserves, and protocol, LP, creator, cashback and buyback fee fields. The full query in examples/solana/pumpswap_reserve_checks.sql verifies four identities for the latest 25 swaps:

  • base reserve movement equals base_token_amount;
  • quote reserve movement equals pool_quote_amount;
  • pool_quote_amount equals swap_quote_amount plus the LP fee for buys, or minus the LP fee for sells; and
  • user_quote_amount equals swap_quote_amount plus all fees for buys, or minus all fees for sells.

The fee total is lp_fee + protocol_fee + coin_creator_fees + cash_back_fees. buy_back_fees is already included in protocol_fee, so adding it again would double-count it. These explicit flow columns handle regular buys, exact-quote buys, v2 instructions and routed swaps consistently. The raw quote_token_amount event field has different meanings across instruction variants and is retained in the output for comparison.

For v2 and multi-hop swaps, fees_retained_in_pool records fees left in the quote vault until a sweep. The vault's post-swap balance is pool_quote_token_reserves_after + fees_retained_in_pool; the reserve column itself is the value used to price the next trade.

It also selects virtual_quote_reserves, coin_creator, coin_creator_fees, cash_back_fees, and buy_back_fees, making the accounting inputs visible beside the checks. This example is based on the field-level accounting described in 10 New Columns in pumpswap_all_swaps.

Run it directly with the repository verifier:

python3 scripts/verify_examples.py --strict-live

The verifier fails if any returned row has a false reconciliation flag and reports its signature and failed identities. This check uses the explicit quote flow columns introduced by the indexer's quote-flow migration; the older quote_token_amount_without_lp_fee changed meaning for newly written buys.

The Docker checker also runs offline regressions against 11 saved transaction cases, covering v1/v2 buys and sells, exact-quote buys, cashback, multi-hop swaps, virtual reserves and boost buys. The tests execute the query's arithmetic and confirm that deliberately corrupted reserves or fees still fail the checks:

python3 scripts/test_pumpswap_reserve_checks.py

Creator migration rates

The creator example takes the latest timestamp present in pumpfun_token_creation, builds a 30-day window ending there, and joins mints to pfamm_migrations. Anchoring to the dataset rather than the wall clock keeps the query reproducible for snapshots and retained archives.

The result contains token counts, migrated counts, migration percentage and the creator's first/last launch time. It is inspired by the cohort construction in Pump.fun’s Creator Economy Is a Barbell.

# Source query
sed -n '1,220p' examples/solana/creator_migration_rates.sql
 
# Execute all bounded examples
python3 scripts/verify_examples.py --strict-live

Fixed-width mint and creator fields are normalized by removing their null-byte padding before the join and grouping.