Query editor
--https://dune.com/queries/3247150/5433054 --OLD QUERY from Polygonwith rr_txs as (selectdate_trunc('day', cast(block_timestamp as timestamp)) as day,sum(case when to_address = 0x28597eA60030fBae79088d89d803f25143c7a6B5 then value_raw/1e18 else 0 end) as stash_in_cu,sum(case when to_address = 0x28597eA60030fBae79088d89d803f25143c7a6B5 then 1 else 0 end) as num_stash_in,count(distinct(case when to_address = 0x28597eA60030fBae79088d89d803f25143c7a6B5 then from_address else null end)) as uniq_address_stash_in,sum(case when from_address = 0x28597eA60030fBae79088d89d803f25143c7a6B5 then value_raw/1e18 else 0 end) as stash_out_cu,sum(case when from_address = 0x28597eA60030fBae79088d89d803f25143c7a6B5 then 1 else 0 end) as num_stash_out,count(distinct(case when from_address = 0x28597eA60030fBae79088d89d803f25143c7a6B5 then to_address else null end)) as uniq_address_stash_outfrom dune.lagunagames12_team.dataset_erc20_transferswhere contract_address = 0x89c49a3fa372920ac23ce757a029e6936c0b8e02group by 1 order by 1 desc)select*,coalesce(stash_in_cu,0) - coalesce(stash_out_cu,0) as daily_change,sum(coalesce(stash_in_cu,0)) over (order by day) - sum(coalesce(stash_out_cu,0)) over (order by day) as balancefrom rr_txswhere day > cast('2024-06-22' as timestamp)order by 1 desclimit 30