maybeyonasparaswap_dex_vol
    Updated 2022-05-09
    with paraswap as (
    select distinct * from (
    select
    -- tx_id
    *
    from ethereum.udm_events
    where (to_label = 'paraswap' or from_label = 'paraswap') or to_address = '0xdef171fe48cf0115b1d80b88dc8eab59176fee57'
    )
    )

    select
    case when to_label in (
    'UNI-AAVE LP','UNI-MATIC LP',
    'UNI-amis token LP','UNI-CRV LP',
    'UNI-BAL LP'
    ) then 'uniswap'
    else to_label end as dex,
    count(distinct tx_id) as swaps,
    sum(
    case when amount_usd > 10000000 then amount_usd/pow(10,18)
    else amount_usd end
    ) as total_vol
    from paraswap
    where
    amount_usd is not null
    and to_label_type = 'dex'
    and to_label != 'paraswap'
    group by 1
    limit 100
    Run a query to Download Data