0xHaM-dklayswap User Label Count
    Updated 2025-02-23
    WITH timeframe AS (
    SELECT date_day AS date
    FROM crosschain.core.dim_dates
    ),
    swapEvent as (
    select
    block_timestamp,
    platform,
    tx_hash,
    ORIGIN_FROM_ADDRESS as swapper,
    symbol_in,
    symbol_out,
    amount_in_usd,
    amount_out_usd,
    nvl(amount_in_usd, amount_out_usd) as amount_usd
    from kaia.defi.ez_dex_swaps
    WHERE platform ilike 'klayswap%'
    )
    ,
    get_volume_per_user as (
    SELECT
    swapper as trader ,
    sum(amount_usd) as total_volume
    FROM swapEvent
    group by 1
    )
    -- forked from 0xDataWolf / Retention Pareto Demo @ https://flipsidecrypto.xyz/0xDataWolf/q/6IUCfIcpSTMC/retention-pareto-demo

    , get_cumulative_count as (
    select
    * , sum(total_volume) over(order by total_volume desc) as cumulative_count
    from get_volume_per_user
    )

    , get_pct_of_cumulative_count as(
    select
    QueryRunArchived: QueryRun has been archived