Afonso_DiazGrouping users
    Updated 2025-04-25
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    args:amount / 1e6 as amount,
    amount as amount_usd,
    args:receiver_id as user
    from
    near.core.fact_actions_events_function_call
    where
    predecessor_id = 'aurora'
    and signer_id = 'relay.aurora'
    and receipt_succeeded
    and receiver_id = '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1'
    and tx_hash in (select distinct tx_hash from near.core.fact_actions_events_function_call where logs::string ilike '%0xe93685f3bba03016f02bd1828badd6195988d950%')
    ),

    users as (
    select
    user,
    count(distinct tx_hash) as transactions
    from main
    group by 1
    )

    SELECT
    CASE
    WHEN transactions = 1 THEN 'A. Single Transaction (1)'
    WHEN transactions BETWEEN 2 AND 5 THEN 'B. Low Activity (2-5)'
    WHEN transactions BETWEEN 6 AND 15 THEN 'C. Moderate Activity (6-15)'
    WHEN transactions BETWEEN 16 AND 30 THEN 'D. Active User (16-30)'
    WHEN transactions BETWEEN 31 AND 50 THEN 'E. Highly Active (31-50)'
    ELSE 'F. Power User (>50)'
    END AS user_type,
    Last run: 10 days ago
    USER_TYPE
    USERS
    1
    A. Single Transaction (1)3149
    2
    D. Active User (16-30)1
    3
    F. Power User (>50)1
    4
    E. Highly Active (31-50)3
    5
    B. Low Activity (2-5)162
    6
    C. Moderate Activity (6-15)25
    6
    187B
    659s