Popex404Daily Holders by Type
    Updated 2024-07-24
    with lastdate as (select
    USER_ADDRESS as address,
    max(LAST_ACTIVITY_BLOCK_TIMESTAMP) as cohortDate
    FROM ethereum.core.ez_current_balances
    where symbol='DYDX' and token_name='dYdX'
    and user_address not in (select address from ethereum.core.dim_labels where address_name is not null)
    and current_bal is not null and current_bal >0
    GROUP BY 1
    )

    select
    Date_trunc('d',LAST_ACTIVITY_BLOCK_TIMESTAMP) as "Date",
    case
    when current_bal <= 10 then 'a 10 or Less DYDX'
    when current_bal between 10 and 100 then 'b 10-100 DYDX'
    when current_bal between 100 and 1000 then 'c 100-1,000 DYDX'
    when current_bal between 1000 and 10000 then 'd 1,000-10,000 DYDX'
    when current_bal between 10000 and 100000 then 'e 10,000-100,000 DYDX'
    when current_bal between 100000 and 1000000 then 'f 100,000-1,000,000 DYDX'
    when current_bal between 1000000 and 10000000 then 'g 1,000,000-10,000,000 DYDX'
    else 'h more than 10M DYDX'
    end as "Holders Type",
    count (distinct user_address) as "Holders"
    FROM ethereum.core.ez_current_balances join lastdate on address = user_address and cohortDate = LAST_ACTIVITY_BLOCK_TIMESTAMP
    where symbol='DYDX' and token_name='dYdX'
    and current_bal is not null and current_bal >0
    GROUP BY 1,2
    QueryRunArchived: QueryRun has been archived