Hossein2024-07-15 02:02 PM copy copy copy
    Updated 2024-07-15
    with arbitrum as (
    select
    block_timestamp::Date AS date,tx_hash,
    amount_in_usd AS amountUSD,
    origin_from_address as user,
    case when symbol_in>symbol_out then symbol_in||' - '||symbol_out else symbol_out||' - '||symbol_in end as pair
    from arbitrum.defi.ez_dex_swaps
    where amount_in_usd<power(10,6)
    and tx_hash in (select distinct(tx_hash) from arbitrum.core.ez_decoded_event_logs where origin_to_address in ('0x5e325eda8064b456f4781070c0738d849c824258','0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b','0x4c60051384bd2d3c01bfc845cf5f4b44bcbe9de5'))
    and date>='2023-01-01'
    and platform = 'uniswap-v3'
    )

    select
    pair,
    case when date>='2023-10-17' then 'after fee changes' else 'before fee changes' end as type,
    count(distinct(date)) as "Dates",
    count(distinct(user)) as "Users",
    count(distinct tx_hash) as "Total Swaps",
    avg(amountUSD) as "Amount Avg",
    sum(amountUSD) as "Total Volume"
    from arbitrum
    group by 1,2
    qualify row_number() over (partition by type order by "Total Volume" desc)<=5




    QueryRunArchived: QueryRun has been archived