Query editor
-- Volume by pool on Solana, derived from dex_solana.trades.-- Solana counterpart of the EVM "volume-by-pool" query (id 7446569).---- Notes on the Solana adaptation:-- * Token addresses are SPL mint addresses (case-sensitive base58),-- not 0x-prefixed hex. We do NOT lowercase them.-- * "Pool" is COALESCE(project_program_id, project_main_id):-- - project_program_id is the per-pool program account (the actual pool).-- - project_main_id is the project's main/factory program id; we fall-- back to it for projects where project_program_id is null (e.g. manifest).-- * fee_tier is read directly from dex_solana.trades. No extra-- dex.pools / dex.raw_pools / aerodrome / pancakeswap CL joins are needed.-- We pick the latest non-null fee_tier per pool inside the date window.-- * amount_usd is already populated by the spell for ~99.7% of rows in-- a recent 24h sample, so we don't add a prices.* fallback (and prices.minute-- does not currently cover Solana anyway).-- * Partition column is block_month — we prune on it for efficiency.-- * start_date / end_date are typed as `text` (Dune's create/update API-- does not accept `datetime`, and the execution API does not accept-- `date`, so `text` is the only type both endpoints accept). Pass either-- 'YYYY-MM-DD' or 'YYYY-MM-DD HH:mm:ss' — the SQL parses both.-- Main parameter CTE: parses template inputs and sets default datesWITH params AS (SELECT-- Comma-separated list of projects to exclude (case-insensitive)SPLIT('{{excluded_projects}}', ',') AS excluded_projects,-- Comma-separated list of base SPL mint addresses (case-sensitive)SPLIT('{{base_mints}}', ',') AS base_mints,-- Start date: parse provided value (date or datetime string) to DATE,-- otherwise default to 2 days ago.COALESCE(TRY_CAST('{{start_date}}' AS DATE),CAST(TRY_CAST('{{start_date}}' AS TIMESTAMP) AS DATE),DATE_ADD('day', -2, CURRENT_DATE)) AS start_date,-- End date: parse provided value, otherwise default to 1 day ago.COALESCE(TRY_CAST('{{end_date}}' AS DATE),CAST(TRY_CAST('{{end_date}}' AS TIMESTAMP) AS DATE),DATE_ADD('day', -1, CURRENT_DATE)) AS end_date),-- Normalize and expand the excluded_projects list into one row per projectexcluded AS (SELECT DISTINCT TRIM(LOWER(x)) AS projectFROM params pCROSS JOIN UNNEST(p.excluded_projects) AS u(x)WHERE TRIM(x) <> ''),-- Normalize and expand the base_mints list. SPL mint addresses are-- base58 and case-sensitive, so we only TRIM (no LOWER, no 0x stripping).base_tokens AS (SELECT DISTINCT TRIM(x) AS mintFROM params p