Updated 2025-03-07
    with dex_list as (
    select
    distinct address_name as address_name,
    address,
    label_type,
    label_subtype,
    label,
    SPLIT_PART(address_name, ':', 1) AS protocol_name
    from
    ink.core.dim_labels
    where
    label_type = 'dex'
    ),
    dex_txns as (
    select
    tt.block_timestamp,
    case
    when tt.from_address in (select address from dex_list) then tt.to_address
    when tt.to_address in (select address from dex_list) then tt.from_address
    else null
    end as user_address,
    dl.protocol_name,
    tt.token_standard,
    tt.name,
    tt.symbol,
    tt.amount_usd,
    ntile(5) over (order by tt.amount_usd) as quintile
    from
    ink.core.ez_token_transfers tt
    left join dex_list dl
    on tt.from_address = dl.address
    or tt.to_address = dl.address
    where
    tt.from_address in (select address from dex_list)
    or tt.to_address in (select address from dex_list)
    and tt.amount_usd is not null
    Last run: about 2 months ago
    QUINTILE
    NUMBER_OF_TRANSACTIONS
    MIN_AMOUNT
    MAX_AMOUNT
    AVG_AMOUNT
    1
    122918500.40.1060816371
    2
    22291850.42.851.68345184
    3
    32291852.8528.8210.701654864
    4
    422918528.82484.18143.806905295
    5
    5229184484.19234403.231209.920592852
    5
    178B
    5s