with new_wallets as (
select
min(block_timestamp) as timestamp,
token_in_contract
from near.core.ez_dex_swaps
group by token_in_contract
),
weekly as (
select
date_trunc('week', timestamp) as week,
count(distinct token_in_contract) as contracts
from new_wallets
group by week
)
select
week,
sum(contracts) over(order by week asc) as cum_contracts
from weekly
order by week asc