Afonso_Diazby platform
    Updated 2025-05-02
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as user,
    symbol_in,
    symbol_out,
    split(platform, '-')[0] as platform,
    greatest(symbol_in, symbol_out) || ' - ' || least(symbol_in, symbol_out) as token_pair,
    iff(symbol_in in ('USDC', 'USDT', 'USDC.e', 'DAI'), 'StableCoin', 'Other') || ' -> ' || iff(symbol_out in ('USDC', 'USDT', 'USDC.e', 'DAI'), 'StableCoin', 'Other') as route,
    case
    when symbol_in in ('USDC', 'USDT', 'USDC.e', 'DAI') then amount_in
    when symbol_out in ('USDC', 'USDT', 'USDC.e', 'DAI') then amount_out
    else nvl(amount_in_usd, amount_out_usd)
    end as amount_usd
    from
    kaia.defi.ez_dex_swaps
    where
    amount_usd > 0
    and block_timestamp >= '2024-01-01'

    )

    select
    platform,
    count(distinct tx_hash) as swaps,
    count(distinct user) as swappers,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as average_amount_usd,
    swaps / count(distinct block_timestamp::date) as daily_average_swaps,
    swappers / count(distinct block_timestamp::date) as daily_average_swappers
    from
    main
    group by 1
    Last run: 28 days ago
    PLATFORM
    SWAPS
    SWAPPERS
    VOLUME_USD
    AVERAGE_AMOUNT_USD
    DAILY_AVERAGE_SWAPS
    DAILY_AVERAGE_SWAPPERS
    1
    dragonswap
    56954085017581576383181.86281200.62351024412798.6696631127.546067
    2
    capybara
    1268670151508214143194.856698129.5374762393604.176136430.420455
    3
    klayswap
    1753103307927138405849.58250646.9267020245202.086053913.72997
    4
    kaiaswap
    3077213011153539243.101072143.356208266881.72206386.277937
    4
    326B
    5s