adriaparcerisasBBx Barbie user stats table
    Updated 2023-07-24
    with
    mints as (
    select
    distinct authorizers[0] as user,
    sum(1) as nft_minted
    --count(distinct x.tx_id) as nft_minted
    --sum(case when event_type='Mint' then transaction_result:events[0]:value:fields[0] end) as volume,
    from flow.core.fact_events x
    join flow.core.dim_contract_labels y on x.event_contract=y.event_contract
    join flow.core.fact_transactions z on x.tx_id=z.tx_id
    where y.event_contract like '%Barbie%' and event_type='Mint'
    and z.tx_succeeded = true and x.block_timestamp>='2023-01-01'
    group by 1
    ),
    buys as (
    select
    distinct buyer as user,
    count(distinct tx_id) as nft_bought
    --CAST(event_data:salePrice AS DECIMAL(18,8)) as price
    from flow.core.ez_nft_sales s
    where
    tx_succeeded = true --and event_type='ListingCompleted'
    and nft_collection='A.e5bf4d436ca23932.BBxBarbieCard'
    --and event_data:buyer is not null and event_data:salePrice is not null
    --and event_data:purchased= 'true'
    group by 1
    ),
    sales as (
    select
    distinct seller as user,
    count(distinct tx_id) as nft_sold
    --CAST(event_data:salePrice AS DECIMAL(18,8)) as price
    from flow.core.ez_nft_sales s
    where
    tx_succeeded = true --and event_type='ListingCompleted'
    Run a query to Download Data