Sbhn_NPAverage Daily Number of Swaps and Swappers on Uniswap
    Updated 2022-10-16
    --credit : alik110
    with maintable as (
    select 'Optimism' as blockchain,
    date_trunc(day,block_timestamp) as date,
    count (distinct tx_hash) as Swaps_Count,
    count (distinct origin_from_address) as Swappers_Count,
    count (distinct contract_address) as Pools_Count
    from optimism.core.fact_event_logs t1
    where origin_to_address = '0xe592427a0aece92de3edee1f18e0157c05861564'
    and event_name = 'Swap'
    and tx_status = 'SUCCESS'
    and block_timestamp >= '2022-06-01'
    group by 1,2

    union ALL

    select 'Arbitrum' as blockchain,
    date_trunc(day,block_timestamp) as date,
    count (distinct tx_hash) as Swaps_Count,
    count (distinct origin_from_address) as Swappers_Count,
    count (distinct contract_address) as Pools_Count
    from arbitrum.core.fact_event_logs t1
    where origin_to_address = '0xe592427a0aece92de3edee1f18e0157c05861564'
    and event_name = 'Swap'
    and tx_status = 'SUCCESS'
    and block_timestamp >= '2022-06-01'
    group by 1,2

    union ALL

    select 'Polygon' as blockchain,
    date_trunc(day,block_timestamp) as date,
    count (distinct tx_hash) as Swaps_Count,
    count (distinct origin_from_address) as Swappers_Count,
    count (distinct contract_address) as Pools_Count
    from polygon.core.fact_event_logs t1
    Run a query to Download Data