Query editor
with labels as (select distinct address,name from labels.allwhere blockchain = 'ethereum'and category in ('contract','social','institution','hackers','infrastructure','dao','ofac_sanction','bridge','dao','project wallet','hackers','Rollup','infrastructure')and (label_type = 'identifier' or (label_type = 'persona' and model_name = 'dao_framework'))union allselect * from query_2640605union allselect address, exchange as namefrom query_2296923),current_bal as (select address, sum(amount) as amount from (select "to" as address, sum(cast(value as double)/1e18) as amountfrom erc20_optimism.evt_Transferwhere contract_address = 0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1and "to" in (select distinct "to" as receiverfrom erc20_optimism.evt_Transferwhere contract_address = 0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1and "from" = 0x7f26A7572E8B877654eeDcBc4E573657619FA3CE)group by 1union allselect "from" as address, sum(cast(value as double)/1e18*-1) as amountfrom erc20_optimism.evt_Transferwhere contract_address = 0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1and "from" in (select distinct "to" as receiverfrom erc20_optimism.evt_Transferwhere contract_address = 0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1and "from" = 0x7f26A7572E8B877654eeDcBc4E573657619FA3CE)group by 1)agroup by 1),daily_claim as (selectDATE_TRUNC('hour', evt_block_time) as hour,COUNT(DISTINCT "to") as users_claimed,SUM(cast(value as double)/1e18) as tokens_claimedfrom erc20_optimism.evt_Transfer aleft join labels b on "to" = b.addressleft join current_bal c on "to" = c.addresswhere contract_address = 0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1and "from" = 0x7f26A7572E8B877654eeDcBc4E573657619FA3CEgroup by 1)selecthour,users_claimed,tokens_claimed,SUM(users_claimed) OVER (ORDER BY hour) as cumulative_users_claimed,SUM(tokens_claimed) OVER (ORDER BY hour) as cumulative_tokens_claimedfrom daily_claimorder by hour;