afonsoOP total Stats
    Updated 2023-04-05
    with t as (
    select
    block_timestamp,
    tx_hash,
    origin_from_address,
    iff(symbol_in = 'OP', amount_in_usd, 0) as outflow_usd,
    iff(symbol_in = 'OP', amount_out_usd, 0) as inflow_usd,
    inflow_usd - outflow_usd as netflow
    from optimism.sushi.ez_swaps
    where 'OP' in (symbol_in, symbol_out)

    union all

    select
    block_timestamp,
    tx_hash,
    origin_from_address,
    iff(symbol_in = 'OP', amount_in_usd, 0) as outflow_usd,
    iff(symbol_in = 'OP', amount_out_usd, 0) as inflow_usd,
    inflow_usd - outflow_usd as netflow
    from optimism.velodrome.ez_swaps
    where 'OP' in (symbol_in, symbol_out)
    )

    select
    count(distinct tx_hash) as swaps_count,
    count(distinct origin_from_address) as swappers_count,
    sum(inflow_usd) as inflow_volume_usd,
    sum(outflow_usd) as outflow_volume_usd,
    inflow_volume_usd - outflow_volume_usd as netflow_volume_usd
    from t
    Run a query to Download Data