Query editor
-- SURF received by the revenue/treasury address, as a daily time series.-- Same transfers the old single-number query summed, bucketed by day with a-- running cumulative (last row's cumulative equals the old total).WITH revenue_transfers AS (SELECTDATE_TRUNC('day', evt_block_time) AS day,SUM(value) / 1e18 AS surf_amountFROM erc20_base.evt_TransferWHERE contract_address = 0xcdca2eaae4a8a6b83d7a3589946c2301040dafbfAND "from" IN (0x51AF6fd4Ce9dceDc3173635408E73B3E207257a5,0xEeEE7d713aDf6f408dd3637987191B35E3A872b0,0x644d2198f5FA119EbD96b3F5A1dC21b5559D521c,0x9fcF7870A4658AC7A0A925F9e6C70D72165f1C6f)AND "to" = 0x8b4D9e217F7dd65a423ea465E2699eB08b82Ca7dGROUP BY 1),date_series AS (SELECT sequence_day AS dayFROM UNNEST(SEQUENCE(DATE((SELECT MIN(day) FROM revenue_transfers)),CURRENT_DATE,INTERVAL '1' DAY)) AS t(sequence_day)),-- Keep daily amounts unrounded so the cumulative SUM uses full precision;-- rounding happens once at the final SELECT.daily_data AS (SELECTd.day,COALESCE(r.surf_amount, 0) AS surf_amountFROM date_series dLEFT JOIN revenue_transfers r ON d.day = r.day)SELECTday,ROUND(surf_amount, 2) AS surf_received,ROUND(SUM(surf_amount) OVER (ORDER BY day ASC), 2) AS cumulative_surf_receivedFROM daily_dataORDER BY day;