adriaparcerisasOptimism DEXs (redux) 5
    Updated 2022-10-26
    --Total number of swaps by day over the last month
    --Total number of wallets swapping by day
    --What are the most popular asset pairs to swap from and too
    --Top 10 assets swapping from
    --Top 10 assets to swap to

    with
    pools as (
    SELECT
    distinct symbol_in as token_1,
    token_address_in as token_1_address,
    symbol_out as token_2,
    token_address_out as token_2_address
    from optimism.velodrome.ez_swaps
    ),
    uniswap as (
    select
    'Uniswap' as project_name,
    token_1,
    count(DISTINCT tx_hash) as swaps,
    count (distinct origin_from_address) as swappers
    from optimism.core.fact_event_logs x
    join pools on contract_address = token_1_address
    where event_name like '%Transfer%' and origin_from_address = event_inputs:to and origin_to_address in('0xe592427a0aece92de3edee1f18e0157c05861564','0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45') and block_timestamp>CURRENT_DATE-INTERVAL'1 month'
    GROUP by 1,2
    order by 1 asc
    ),
    sushiswap as (
    select
    'Suhiswap' as project_name,
    symbol_in as token_1,
    count(DISTINCT tx_hash) as swaps,
    count (distinct origin_from_address) as swappers
    from optimism.sushi.ez_swaps
    where block_timestamp>CURRENT_DATE-INTERVAL'1 month'
    GROUP by 1,2
    Run a query to Download Data