Updated 2022-09-12
    WITH
    sales AS (
    SELECT
    events.tx_hash,
    events.origin_to_address AS marketplace,
    events.event_inputs:from AS seller,
    events.event_inputs:to AS buyer,
    events.event_inputs:tokenId AS token,
    events.contract_address AS collection,
    transactions.matic_value AS price
    FROM
    polygon.core.fact_event_logs events
    JOIN
    polygon.core.fact_transactions transactions
    ON
    events.tx_hash = transactions.tx_hash
    WHERE
    events.event_inputs:to ='0xEC5F4eA1F761F507a616E4C6226084AB2F32D218'
    )
    SELECT
    COUNT(DISTINCT tx_hash) AS txn,
    COUNT(DISTINCT marketplace) AS marketplaces,
    COUNT(DISTINCT seller) AS sellers,
    COUNT(DISTINCT buyer) AS buyers,
    COUNT(DISTINCT token) AS nfts,
    COUNT(DISTINCT collection) AS collections,
    SUM(price) AS volume,
    (volume / nfts) AS price
    FROM
    sales
    Run a query to Download Data