Query editor
with date_series as (selecttimestamp as dayfrom utils.dayswhere timestamp >= timestamp '2024-09-01 00:00:00'),wallets as (selectdate_series.day as day,count(safe) as wallets_deployed,sum(count(safe)) over (order by date_series.day) as wallets_deployed_cumulativefrom date_seriesleft join rumpel_ethereum.rumpelwalletfactory_evt_safecreated safeon date_series.day = date_trunc('day', evt_block_time)group by 1),index as (select distinctday,wallet,contract_address,symbol,pricefrom dune.rumpel_protocol.result_rumpel_protocol_indexcross join (select distinct"to" as walletfrom erc20_ethereum.evt_transferwhere evt_block_time >= timestamp '2024-09-01 00:00:00'and contract_address in (select distinct pToken from rumpel_ethereum.pointtokenvault_evt_ptokendeployed)) walletswhere day >= timestamp '2024-09-13 00:00:00'and contract_address in (select distinct pToken from rumpel_ethereum.pointtokenvault_evt_ptokendeployed)),pt as (selectday,count(case when amount_usd_cumulative > 1 then wallet end) as user_count,sum(sum(rn)) over (order by day) as user_count_cumulativefrom (selectindex.day,index.wallet,index.contract_address,index.price,sum(amount) as amount,index.price * sum(amount) as amount_usd,index.price * sum(sum(amount)) over (partition by index.wallet, index.contract_address order by index.day) as amount_usd_cumulative,case when row_number() over (partition by pt.user order by index.day) = 1 then 1 else 0 end as rnfrom indexleft join (selectdate_trunc('day', evt_block_time) as day,"to" as user,contract_address,cast(value as double) as amountfrom erc20_ethereum.evt_transferwhere contract_address in (select distinct pToken from rumpel_ethereum.pointtokenvault_evt_ptokendeployed)union allselectdate_trunc('day', evt_block_time) as day,"from" as user,contract_address,-cast(value as double) as amountfrom erc20_ethereum.evt_transferwhere contract_address in (select distinct pToken from rumpel_ethereum.pointtokenvault_evt_ptokendeployed)) pton index.day = pt.dayand index.wallet = pt.user