with contract as ( select
'Contract_Id:' || POOL_IDS[0] as contract,
min(block_timestamp::date) as date
from osmosis.core.fact_swaps
where block_timestamp::date >= '2022-05-01' -- top contracts from beginning of May
and TX_STATUS='SUCCEEDED'
group by contract
having contract is not null
order by date
)
SELECT date,
count(contract) as number_of_contracts,
sum(number_of_contracts) over (order by date) as cumulative_contracts
from contract
group by date
order by number_of_contracts