Sbhn_NPwillowy-tan
    Updated 2025-03-16
    with price as (
    select hour::date as datee,
    avg(price) as usdprice
    from ink.price.ez_prices_hourly
    where symbol = 'WETH'
    group by 1
    ),

    base as (select origin_from_address,
    sum((ethereum.public.udf_hex_to_int(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[6]) / pow(10,18))*usdprice) usd
    from ink.core.fact_event_logs
    join price on block_timestamp::date=datee
    where topic_0 in ('0x4b5824a0f21039d7160b2a57d8c140cae3ba13e4f15bcd879cc63e4964681a9e','0x0d29d7b2727600087ca17290038d4c09dc340440df666c931e739ad49594669e')
    and origin_to_address = '0x1d74317d760f2c72a94386f50e8d10f2c902b899'
    and concat('0x', right(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[4],40)) != '0x1d74317d760f2c72a94386f50e8d10f2c902b899'
    group by 1
    )

    select case when usd<10 then 'Less Than 10$'
    when usd>-10 and usd<100 then '10$ - 100$'
    when usd>-100 and usd<1000 then '100$ - 1,000$'
    when usd>-1000 and usd<10000 then '1,000$ - 10,000$'
    else 'More Than 10,000$' end as splitter,
    count(distinct origin_from_address) as users
    from base
    group by 1
    Last run: about 1 month ago
    SPLITTER
    USERS
    1
    Less Than 10$5712
    2
    10$ - 100$597
    3
    1,000$ - 10,000$188
    4
    More Than 10,000$27
    5
    100$ - 1,000$605
    5
    115B
    11s