zakkisyed#3 Polygon NFT: Top 100 buyers of the day
    Updated 2022-07-16
    with polygon_nft_sales as (
    select
    block_timestamp,
    tx_hash,
    matic_value,
    event_inputs :
    from
    as seller,
    event_inputs : to as buyer,
    event_inputs : tokenId as token_id,
    contract_address as nft_collection
    from
    polygon.core.fact_event_logs logs
    join polygon.core.fact_transactions transactions using(tx_hash)
    where
    event_inputs : tokenId is not null
    and event_inputs :
    from
    != '0x0000000000000000000000000000000000000000'
    and event_inputs : to != '0x0000000000000000000000000000000000000000'
    and matic_value > 0
    and tx_status = 'SUCCESS'
    and event_name = 'Transfer'
    and block_timestamp :: date <= current_date - 1
    )
    select
    buyer as buyer,
    count(distinct tx_hash) as "Number of NFT Sales",
    sum(matic_value) as "Volume of NFT Sales (MATIC)"
    from
    polygon_nft_sales
    group by
    1
    order by
    2 desc
    limit
    Run a query to Download Data