with Topshot_contracts as (
select CONTRACT_NAME, EVENT_CONTRACT from flow.core.dim_contract_labels
where CONTRACT_NAME ilike '%TopShot%'
group by 1,2
)
select block_timestamp::date as date ,
count(DISTINCT buyer) as num_buyers,
count (DISTINCT seller) as num_sellers ,
count (DISTINCT tx_id) as num_sales ,
sum (num_sales) over (order by date ) as cum_sales
from flow.core.fact_nft_sales join Topshot_contracts
on EVENT_CONTRACT = NFT_COLLECTION
where TX_SUCCEEDED = true
and block_timestamp::date >= '2022-04-01'
group by 1