mhmCompare swaps on DEXs on Optimism
    Updated 2022-08-04
    with velodrome_bridges as (
    select 'velodrome' as dex, *
    from optimism.core.fact_transactions
    where to_address = '0xa132dab612db5cb9fc9ac426a0cc215a3423f9c9'
    and ORIGIN_FUNCTION_SIGNATURE = '0xf41766d8'
    ), uniswap_bridges as (
    select 'uniswap' as dex, *
    from optimism.core.fact_transactions
    where to_address = '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45'
    and ORIGIN_FUNCTION_SIGNATURE = '0x5ae401dc'
    ), sushiswap_bridges as (
    select 'sushiswap' as dex, *
    from optimism.core.fact_transactions
    where to_address = '0xbe811a0d44e2553d25d11cb8dc0d3f0d0e6430e6' -- Sushiswap
    and ORIGIN_FUNCTION_SIGNATURE in ('0xac9650d8', '0xb96c5c0e', '0x9fa74491', '0x0b0d1b1e')
    ), bridges as (
    select * from velodrome_bridges
    union all
    select * from uniswap_bridges
    union all
    select * from sushiswap_bridges
    ), transfers_tokens as (
    select
    case
    when ORIGIN_FUNCTION_SIGNATURE = '0xf41766d8' then 'Velodrome'
    when ORIGIN_FUNCTION_SIGNATURE = '0x5ae401dc' then 'Uniswap'
    when ORIGIN_FUNCTION_SIGNATURE in ('0xac9650d8', '0xb96c5c0e', '0x9fa74491', '0x0b0d1b1e') then 'Sushiswap'
    end as dex,
    block_timestamp,
    tx_hash,
    ORIGIN_FUNCTION_SIGNATURE,
    ORIGIN_FROM_ADDRESS,
    ORIGIN_TO_ADDRESS,
    CONTRACT_ADDRESS,
    FROM_ADDRESS,
    TO_ADDRESS,
    Run a query to Download Data