-- Payout 125 USDC
-- Grand Prize 2000 USDC
-- Level Advanced
-- Show us what you can do with this new Optimism data!
with
txns as (
select
*
from flow.core.fact_swaps
)
select
block_timestamp::date as date,
count(distinct trader) as n_users,
count(distinct tx_id) as swap_frequency,
sum(n_users) over (order by date asc rows between unbounded preceding and current row) as cum_n_users,
sum(swap_frequency) over (order by date asc rows between unbounded preceding and current row) as cum_swap_frequency
from txns
where block_timestamp between '2022-05-01' and '2022-05-30'
group by date