Query editor
with sc_hatch as (SELECTdate_trunc('day', block_time) AS day, count(*) as hatched_shadowcornsFROM polygon.logsWHERE topic0 = 0x7f9c25d6d234ff14ad2632c2c2622a2ab300623506259eade5d28606d1644f80and block_time > cast('2022-07-01' as timestamp)group by 1),days as (selectcast(day as timestamp) as dayfrom unnest(sequence(date('2022-07-01'), cast(now() as date), interval '1' day)) as t(day)),corn_integrated AS (SELECTevt_block_time, "from" as wallet, -1 as helperFROM erc721_polygon.evt_TransferWHERE contract_address = 0xa7D50EE3D7485288107664cf758E877a0D351725and not to = 0x94f84d94A1b8Ce60C5F99eAF89b4679bf9Bf598cUNION ALLSELECTevt_block_time, to as wallet, +1 as helperFROM erc721_polygon.evt_TransferWHERE contract_address = 0xa7D50EE3D7485288107664cf758E877a0D351725and not "from" = 0x94f84d94A1b8Ce60C5F99eAF89b4679bf9Bf598c),corn_calc as (select evt_block_time, wallet,sum(helper) over (partition by wallet order by evt_block_time) as holdingfrom corn_integratedwhere wallet <> 0x0000000000000000000000000000000000000000),corn_lead as (select evt_block_time, wallet, holding,lead(evt_block_time, 1, now()) over(partition by wallet order by evt_block_time asc) as next_evtfrom corn_calc),corn_filled as (select calender.day as days, wallet, holdingfrom (select cast(day as timestamp) as dayfrom unnest(sequence(date('2022-01-01'), cast(now() as date), interval '1' day)) as t(day)) as calenderleft join corn_lead t on t.evt_block_time <= calender.day and calender.day < t.next_evtwhere holding > 0),sc_holders as (SELECTdays, count(distinct wallet) as num_holderFROM corn_filledGROUP BY 1order by 1 desc)selectd.day,coalesce(hatched_shadowcorns,0) as sc_hatched_day, --"SC Hatched/Day",sum(coalesce(hatched_shadowcorns,0)) over (order by d.day) as total_sc_hatched, --"Total Hatched SC",coalesce(hatched_shadowcorns,0) * 10000 as unim_per_day, --"UNIM Burned/day",coalesce(hatched_shadowcorns,0) * 100 as rbw_per_day, --"RBW Spent/day",sum(coalesce(hatched_shadowcorns,0)) over (order by d.day) * 10000 as tot_unim_burned, --"Cumulative UNIM Burned",