primo_dataTop NFTs by Sales ($USD)
    Updated 2022-11-27
    -- NFTs: https://app.flipsidecrypto.com/velocity/queries/e54a2207-ed4b-4811-a269-3606c75d8e47
    with nft_sales as (
    select
    date(block_timestamp) dt
    ,tx_hash
    ,contract_address nft_address
    ,event_inputs:from seller_address
    ,event_inputs:to buyer_address
    from optimism.core.fact_event_logs
    where origin_to_address in ('0x3f9da045b0f77d707ea4061110339c4ea8ecfa70','0x20975da6eb930d592b9d78f451a9156db5e4c77b','0x065e8a87b8f11aed6facf9447abe5e8c5d7502b6') --quixotic contracts
    and event_name = 'Transfer'
    and event_inputs:to = origin_from_address
    and nft_address != '0x4200000000000000000000000000000000000006'
    ),
    price as (
    select
    tx_hash
    ,eth_value
    from optimism.core.fact_transactions
    ),
    eth_price as (
    select date(hour) dt, avg(price) avg_price
    from flipside_prod_db.ethereum.token_prices_hourly
    where hour >= date('2022-06-15')
    and symbol = 'WETH'
    group by 1
    ),
    details as (
    select
    n.dt
    ,n.tx_hash tx_hash -- adding x to beginning so tableau data connector reads column as a string
    ,n.nft_address nft_address
    ,n.seller_address seller_address
    ,n.buyer_address buyer_address
    ,l.address_name
    ,p.eth_value
    Run a query to Download Data