RayyykL2StateOfMind 5
    Updated 2022-09-02
    with table_1 as (select origin_from_address as wallets
    from optimism.core.fact_event_logs
    where contract_address ilike '0x66Deb6cC4d65dc9CB02875DC5E8751d71Fa5D50E'
    and tx_status = 'SUCCESS'
    and event_name = 'Transfer'),

    table_2 as (select buyer_address,
    count(distinct(tx_hash)) as nft_bought,
    sum(price_usd) as volume_usd
    from optimism.core.ez_nft_sales a
    join table_1 b on a.buyer_address = b.wallets
    where block_timestamp >= current_date - 90
    group by 1)

    select buyer_address,
    sum(volume_usd) as usd_volume,
    row_number () over (order by usd_volume desc) as count
    from table_2
    group by 1
    order by 2 desc
    Run a query to Download Data