freemartianSales Stats Single number
    Updated 2022-11-21
    with source_mints as (
    select
    tx_hash,
    block_timestamp,
    contract_address as collection,
    event_inputs:_to as minter,
    event_inputs:_id as NFTid
    from polygon.core.fact_event_logs
    where origin_function_signature in ('0x5a86c41a', '0x669f5a51')
    and event_inputs:_from = '0x0000000000000000000000000000000000000000'
    and event_name = 'TransferSingle'
    and tx_status = 'SUCCESS'),

    sales as (
    select
    tx_hash,
    event_inputs:_from,
    event_inputs:_to,
    event_inputs:_id
    from polygon.core.fact_event_logs
    where contract_address in (select collection from source_mints)
    and event_inputs:_from != '0x0000000000000000000000000000000000000000'
    and event_inputs:_to != '0x0000000000000000000000000000000000000000'
    and event_name = 'TransferSingle'
    and tx_status = 'SUCCESS'),

    prices as (
    select
    block_timestamp,
    tx_hash,
    from_address as seller,
    to_address as buyer,
    case when from_address = seller then raw_amount/pow(10,18) end as price_in_eth
    from polygon.core.fact_token_transfers
    where tx_hash in (select tx_hash from sales) )

    Run a query to Download Data