nsa2000Secondary Sales vs. Mint Sales Over Time
    Updated 2022-10-23
    WITH mintTb as (
    SELECT
    tx_id as tx_hash,
    event_data:id as nft_id
    FROM flow.core.fact_events
    WHERE event_contract LIKE 'A.329feb3ab062d289.RaceDay_NFT'
    AND event_type LIKE 'Minted'
    )
    SELECT
    date_trunc('week', block_timestamp) as mint_date,
    'Mint' as status,
    count(DISTINCT c.nft_id) as mints,
    count(DISTINCT event_data:to) as minters,
    sum(mints) over (order by mint_date) as cum_mints
    FROM flow.core.fact_events a
    LEFT outer JOIN mintTb c
    ON (c.nft_id = a.event_data:id AND c.tx_hash = a.tx_id)
    WHERE event_type LIKE 'Deposit'
    AND NOT c.tx_hash is NULL
    AND event_contract LIKE 'A.329feb3ab062d289.RaceDay_NFT'
    GROUP BY 1 ,2

    UNION
    SELECT
    date_trunc('week', block_timestamp) as sales_date,
    'Sales' as status,
    count(distinct tx_id) as Sales_Cnt,
    count(distinct buyer) as Buyers_Cnt,
    sum(Sales_Cnt) over (order by sales_date) as cum_Sales_Cnt
    FROM flow.core.ez_nft_sales
    where nft_collection = 'A.329feb3ab062d289.RaceDay_NFT'
    and tx_succeeded = 'TRUE'
    GROUP BY 1,2
    Run a query to Download Data