Hessishnom bal dis
Updated 2025-05-16Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- forked from nom bal @ https://flipsidecrypto.xyz/studio/queries/17195bbe-82f4-4241-8142-f762a67e01a9
with all_actions as (SELECT BLOCK_TIMESTAMP,
'0x'||SUBSTRING(TOPICS[2], 27) as receiver,
ethereum.public.udf_hex_to_int(topics[3]) as token_id ,TX_HASH
from monad.testnet.fact_event_logs
WHERE
CONTRACT_ADDRESS = lower('0x3019bf1dfb84e5b46ca9d0eec37de08a59a41308') and
TOPICS[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
and TX_SUCCEEDED = 'TRUE'
),
owenrs as (select token_id, receiver
from (
select distinct token_id, receiver,
row_number() over (partition by token_id order by BLOCK_TIMESTAMP desc) as rn
from all_actions
) as ranked_actions
where rn = 1),
final as (select distinct receiver as user ,count(distinct token_id) as "NOM balance"
from owenrs
group by 1 )
select case
when "NOM balance" = 1 then 'A) 1 domain'
when "NOM balance" > 1 and "NOM balance" < 5 then 'B) 2~4 domains'
when "NOM balance" >= 5 and "NOM balance" < 10 then 'C) 5~9 domains'
when "NOM balance" >= 10 then 'D) +10 domains' end as ".nom balance",
count(DISTINCT user) as users
from final
group by all
order by 1
QueryRunArchived: QueryRun has been archived