Query editor
withinception_tokens_names as (select blockchain, token_address, symbolfrom query_3905729 -- Inception Token List),date_bounds as (selectcast(min(date_trunc('day', evt_block_time)) as date) as min_date,cast(max(date_trunc('day', evt_block_time)) as date) as max_datefrom query_3905804 -- Inception Bridge Events),calendar as (select date_column as dayfrom (select sequence((select min_date from date_bounds),(select max_date from date_bounds),interval '1' day) as date_arrayfrom date_bounds) as t1cross join unnest(date_array) as t2(date_column)),full_dates_contracts as (selectc.day,itn.token_address as contract_address,itn.symbolfrom calendar ccross join inception_tokens_names itn),contract_stats as (select c.day, q.token, coalesce(sum(case when q.event = 'deposit' then q.amount else 0 end), 0)/1e18 as total_deposits,coalesce(count(distinct (case when q.event = 'deposit' then q.receiver end)), 0) as unique_daily_depositors,coalesce(sum(case when q.event = 'withdrawn' then q.amount else 0 end), 0)/1e18 as total_withdrawals,coalesce(count(distinct (case when q.event = 'withdrawn' then q.receiver end)), 0) as unique_daily_withdrawers,(coalesce(sum(case when q.event = 'deposit' then q.amount else 0 end), 0)/1e18 - coalesce(sum(case when q.event = 'withdrawn' then q.amount else 0 end)/1e18, 0)) as net_tvlfrom calendar as cleft join query_3796814 as q on date_trunc('day', q.evt_block_time) = c.daygroup by c.day, q.tokenorder by c.day desc),final_stats as (selectf.day,f.contract_address,f.symbol,coalesce(cs.total_deposits, 0) as total_deposits,coalesce(cs.unique_daily_depositors, 0) as unique_daily_depositors,coalesce(cs.total_withdrawals, 0) as total_withdrawals,coalesce(cs.net_tvl, 0) as net_tvl,SUM(COALESCE(cs.net_tvl, 0)) OVER (PARTITION BY f.contract_address ORDER BY f.day) AS cumulative_net_tvlfrom full_dates_contracts f