Query editor
WITH summary AS (SELECT-- sum unique users per token(SELECT SUM(unique_users) FROM (SELECT COUNT(DISTINCT user_address) as unique_usersFROM dune.serotonin_data.mamo_depositsGROUP BY symbol)) AS total_user,COUNT(*) AS actions,COUNT(*) FILTER(WHERE action = 'deposit') AS deposits_count,COUNT(*) FILTER(WHERE action = 'withdraw') AS withdraws_count,SUM(amount_usd) FILTER(WHERE action = 'deposit') AS usd_deposited,SUM(amount_usd) FILTER(WHERE action = 'withdraw') AS usd_withdrew,SUM(amount_usd) AS net_usd_depositedFROMdune.serotonin_data.mamo_deposits),mamo_overview AS (WITH mamo_deposits AS (SELECT * FROM dune.serotonin_data.mamo_deposits),time_series AS (SELECTDATE(block_time) AS date,symbol AS token,COUNT(DISTINCT user_address) AS unique_depositors,COUNT(*) AS deposit_count,SUM(amount_usd) FILTER(WHERE action = 'deposit') AS usd_deposited,SUM(amount_usd) FILTER(WHERE action = 'withdraw') AS usd_withdrew,SUM(amount) AS net_amount_deposited,SUM(amount_usd) AS net_usd_depositedFROM mamo_depositsGROUP BY 1, 2),dates AS (SELECTdays,token_typeFROM (SELECT token_type FROM UNNEST(ARRAY['USDC', 'cbBTC', 'MAMO', 'WETH']) AS t(token_type)) tokensCROSS JOINUNNEST(SEQUENCE((SELECT DATE(MIN(date)) FROM time_series),(SELECT DATE(MAX(date)) FROM time_series),INTERVAL '1' DAY)) AS t(days)),agg_data AS (SELECT*,SUM(usd_deposited) OVER (PARTITION BY token ORDER BY date ASC) AS cumulative_deposited,SUM(usd_withdrew) OVER (PARTITION BY token ORDER BY date ASC) AS cumulative_withdrew,SUM(net_amount_deposited) OVER (PARTITION BY token ORDER BY date ASC) AS total_tokens--SUM(unique_depositors) OVER (PARTITION BY token ORDER BY date ASC) AS cumulative_unique_depositorsFROM (SELECTDATE_TRUNC('day', dt.days) AS date,