Query editor
with iv_cal (tt, display_tf) as (select *,case when tt > timestamp '2025-05-27 08:00' then true else false end as display_tffrom (select *from UNNEST(sequence(timestamp '2025-03-01 00:00', cast(current_timestamp as timestamp), interval '1' hour)) as x(tt))),iv_trans as (select a.evt_block_time as block_time,case when "from" = 0x0000000000000000000000000000000000000000 and to <> 0x0000000000000000000000000000000000000000 then 'mint'when "from" <> 0x0000000000000000000000000000000000000000 and to = 0x0000000000000000000000000000000000000000 then 'burn'else 'trans'end as tx_type,evt_tx_hash as tx_hash,"from" as from_address,"to" as to_address,value/1e18 as token_amtfrom erc20_ethereum.evt_transfer awhere a.contract_address = 0x259338656198eC7A76c729514D3CB45Dfbf768A1 -- RESOLVand a.evt_block_time >= timestamp '2025-03-01' -- 2025-03-19),iv_base as (select date_trunc('hour', block_time) as hh,coalesce(address_group, '[etc]') as address_name,sum(token_amt) as token_amtfrom iv_trans aleft join query_5336920 b on b.address = a.to_addresswhere tx_type <> 'burn'group by 1,2union allselect date_trunc('hour', block_time) as hh,coalesce(address_group, '[etc]') as address_name,sum(-token_amt) as token_amtfrom iv_trans aleft join query_5336920 b on b.address = a.from_addresswhere tx_type <> 'mint'group by 1,2)select a.*,case when address_name = 'reserve' then 0 else token_amt end as token_amt2from (select a.tt,b.address_name,sum(b.token_amt) as token_amtfrom iv_cal aleft join iv_base b on b.hh <= a.ttwhere a.display_tfgroup by 1,2) aorder by 1 desc, 2