adriaparcerisasget all owners of nft from nft collection x
    Updated 2024-08-02
    with
    mints as (
    select
    distinct proposer as user,
    sum(1) as nft_minted
    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 ilike '%{{collection}}%' and event_type='Mint'
    and z.tx_succeeded = true
    group by 1
    ),
    buys as (
    select
    distinct event_data:buyer as user,
    count(distinct tx_id) as nft_bought
    from flow.core.fact_events s
    where
    tx_succeeded = true and event_type='ListingCompleted'
    and event_data:nftType ilike '%{{collection}}%'
    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 event_data:storefrontAddress as user,
    count(distinct tx_id) as nft_sold
    from flow.core.fact_events s
    where
    tx_succeeded = true and event_type='ListingCompleted'
    and event_data:nftType ilike '%{{collection}}%'
    and event_data:buyer is not null and event_data:salePrice is not null
    and event_data:purchased= 'true'
    group by 1
    )
    QueryRunArchived: QueryRun has been archived