with t as
(select e.block_timestamp as date_time,
receiver_id as receiver,
row_number() over (partition by receiver_id order by e.block_timestamp asc) as num_r
from near.core.fact_actions_events e join near.core.fact_receipts f on f.tx_hash = e.tx_hash
where date_trunc('day', e.block_timestamp) >= '2022-05-01' and date_trunc('day', e.block_timestamp) <= '2022-07-31' and action_name ilike '%DEPLOYCONTRACT%'
group by receiver, date_time
qualify num_r = 1)
select date_trunc('DAY', date_time) as date,
count(distinct receiver) as "count contracts",
sum("count contracts") over(order by date asc) as "Cumulative count contracts"
from t group by date order by date asc