freemartianDaily Sale Volume
    Updated 2022-12-05
    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
    block_timestamp::date as day,
    tx_hash,
    event_inputs:_from as seller,
    event_inputs:_to as buyer,
    event_inputs:_id as traded_NFT
    from polygon.core.fact_event_logs
    where contract_address in (select collection from source_mints)
    and event_inputs:_from != '0x0000000000000000000000000000000000000000'
    and event_name = 'TransferSingle'
    and tx_status = 'SUCCESS'),

    prices as (
    select
    block_timestamp,
    s.tx_hash,
    case when from_address = seller then raw_amount/pow(10,18) end as price_in_eth
    from polygon.core.fact_token_transfers t inner join sales s on t.tx_hash = s.tx_hash)

    SELECT
    block_timestamp::date as day,
    sum(price_in_eth) as total_volume
    Run a query to Download Data