Query editor
-- =========================================================-- QUERY A: Qualifying Solana meme-coin tokens (7-day window)-- scope: Pump.fun + PumpSwap (Raydium LaunchLab/Bonk.fun dropped).-- NOTE: Pump.fun-only was tested and returns ZERO qualifying-- tokens -- almost all real fee/liquidity volume happens AFTER a-- token migrates to PumpSwap, so PumpSwap has to stay in for the-- $15k liquidity / 20 SOL fee thresholds to ever be met. This-- version needs the MEDIUM engine -- it does not fit small's-- 2-minute cap.-- liquidity >= $15,000-- holders > 100-- global fees >= 20 SOL (cumulative, converted from fee_usd)---- OPTIMIZED FOR THE SMALL ENGINE: the previous version scanned-- dex_solana.trades four separate times (once each for first_trade,-- token_stats, liquidity, latest_price). This version scans it ONCE-- into base_trades and every other CTE reads from that instead ---- roughly a 4x cut in the heaviest cost. holder_count also switched-- from COUNT(DISTINCT address) to approx_distinct(address), which is-- far cheaper at scale and accurate to within ~2%, more than good-- enough for a ">100 holders" threshold check.---- Run this on the SMALL engine, save it on Dune, then note its-- query ID from the URL (dune.com/queries/1234567 -> query_1234567).-- Paste that ID into QUERY B's `FROM query_XXXXXXX` line.-- =========================================================WITH sol_price AS (SELECT timestamp AS price_date, price AS sol_usdFROM prices.dayWHERE blockchain = 'solana'AND contract_address = from_base58('So11111111111111111111111111111111111111112')AND timestamp >= CURRENT_DATE - INTERVAL '7' day),excluded_mints AS (SELECT * FROM (VALUES('So11111111111111111111111111111111111111112'), -- SOL('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'), -- USDC('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'), -- USDT('mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So') -- mSOL) AS t(mint)),-- =========================================================-- SINGLE SCAN of dex_solana.trades for the whole 7-day window.-- Only the columns actually used downstream are kept, to reduce-- how much data has to move through the rest of the query.-- =========================================================base_trades AS (SELECTt.block_time,t.block_slot,t.token_bought_mint_address,t.token_bought_symbol,t.token_bought_amount,t.token_sold_vault,t.amount_usd,t.fee_usdFROM dex_solana.trades t