Query editor
WITH/* =========================================================SURFLIQUID VOLUMEPulled from the saved SurfLiquid volume query on Dune(https://dune.com/queries/6117410) instead of recomputingit on-chain here. query_<ID> references that query as aview: Dune serves its latest cached run when fresh,otherwise re-executes it. It outputs one row per day since2025-08-30 covering Base + Polygon + Ethereum, all vaultversions, bridges, staking, CreatorBid, and SURF league.========================================================= */surf_daily_volume AS (SELECTCAST(day AS TIMESTAMP) AS day,daily_volume_usdFROM query_6117410),dec_prices AS (SELECT DATE_TRUNC('day', minute) AS day, AVG(price) AS priceFROM prices.usdWHERE blockchain = 'ethereum'AND contract_address = 0x9393fdc77090F31c7db989390D43F454B1A6E7F3GROUP BY 1),sps_prices AS (SELECT DATE_TRUNC('day', minute) AS day, AVG(price) AS priceFROM prices.usdWHERE blockchain = 'ethereum'AND contract_address = 0x00813E3421E1367353BfE7615c7f7f133C89df74GROUP BY 1),/* =========================================================G2B OFFCHAIN VOLUME========================================================= */g2b_daily_totals AS (SELECTDATE_TRUNC('day', created_at) AS day,SUM(CASE WHEN LOWER(token) = 'dec' THEN CAST(amount AS DOUBLE) / 1e3 ELSE 0 END) AS total_dec,SUM(CASE WHEN LOWER(token) = 'sps' THEN CAST(amount AS DOUBLE) / 1e18 ELSE 0 END) AS total_spsFROM dune.ankurdahiya.g2b_dataGROUP BY 1),g2b_daily_volume AS (SELECTg.day,ROUND(COALESCE(g.total_dec, 0) * COALESCE(dp.price, 0)+ COALESCE(g.total_sps, 0) * COALESCE(sp.price, 0),2) AS daily_volume_usdFROM g2b_daily_totals gLEFT JOIN dec_prices dp ON g.day = dp.dayLEFT JOIN sps_prices sp ON g.day = sp.day),/* =========================================================