Query editor
withmellow_vaults as (select distinct vault, vault_name, 'mellow' as protocolfrom dune.maybeyonas.result_mellow_vaults),other_vaults as (select vault, vault_name,protocolfrom query_3896330),all_vaults as (select * from mellow_vaultsunion allselect * from other_vaults),actions as (select * from query_3818541where underlying_token in (0x2260fac5e5542a773aa44fbcfedf7c193bc2c599, -- WBTC0x18084fba666a33d37592fa2633fd49a74dd93a88, -- tBTC0x8236a87084f8B84306f72007F36F2618A5634494 -- LBTC) -- update in the cross join too),daily_agg as (selectdate_trunc('day', a.evt_block_time) as date,-- a.operator,-- a.operator_name,a.underlying_token,coalesce(ov.vault_name, 'non-LRT') as lrt,coalesce(ov.protocol, 'non-LRT') as lrt_protocol,sum(case actionwhen 'deposit' then (shares/pow(10, decimals))else -(shares/pow(10, decimals))end) as sharesfrom actions aleft join all_vaults ovon a.staker = ov.vault-- where operator = 0x5accc90436492f24e6af278569691e2c942a676d-- and underlying_token = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2group by 1,2,3,4),days AS (with days_seq as (SELECTsequence((date('2024-08-14')),date_trunc('day', cast(now() as timestamp)),interval '1' day) as day)SELECTdays.day as dateFROM days_seqCROSS JOIN unnest(day) as days(day) --this is just doing explode like in spark sql),daily_fillers as (select * from days d cross join (select distinct underlying_token, a.vault_name as lrt, a.protocol as lrt_protocolfrom query_3818499 q -- vaults