misaghlbSushi vs Uni on L2
    Updated 2022-10-15
    with uniswap_contract as (
    select
    *
    from arbitrum.core.dim_labels
    where 1=1
    and project_name ilike 'uniswap'
    and LABEL_SUBTYPE = 'swap_contract'
    ),
    fact_log as (
    select
    TX_HASH,
    contract_address,
    ORIGIN_FROM_ADDRESS as user_address,
    ORIGIN_TO_ADDRESS as platform,
    case when try_to_number(event_inputs:amount0::string) < 0 then abs(try_to_number(event_inputs:amount0::string))
    else abs(try_to_number(event_inputs:amount1::string)) end as amount_in,
    case when try_to_number(event_inputs:amount0::string) > 0 then abs(try_to_number(event_inputs:amount0::string))
    else abs(try_to_number(event_inputs:amount1::string)) end as amount_out
    from arbitrum.core.fact_event_logs
    where 1=1
    and ORIGIN_TO_ADDRESS in (select ADDRESS from uniswap_contract)
    and event_name = 'Swap'
    and event_inputs:liquidity is not null
    --and tx_hash = '0x85e7a4e237777a72dbd1f09158c129458c3edc922cbe58eded51d03b21945371'
    --order by EVENT_INDEX asc
    --limit 3
    ),
    swap_tokens as (
    select
    t.block_timestamp,
    f.tx_hash,
    user_address,
    f.contract_address as pair_address,
    Run a query to Download Data