noanuman-1x1vZpTOP 10 holders
Updated 2024-10-06
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
›
⌄
WITH token_address AS (
SELECT LOWER('0xaaeE1A9723aaDB7afA2810263653A34bA2C21C7a') AS tokenADR
),
-- Get the current token price
current_price AS (
SELECT
price
FROM ETHEREUM.price.ez_prices_hourly
WHERE token_address = (SELECT tokenADR FROM token_address)
ORDER BY hour DESC
LIMIT 1
),
top_10_holders AS (
SELECT
user_address,
CAST(SUM(current_bal) AS DOUBLE) AS total_balance
FROM ETHEREUM.core.ez_current_balances
WHERE contract_address = (SELECT tokenADR FROM token_address) AND user_address != LOWER('0x000000000000000000000000000000000000dead')
GROUP BY user_address
ORDER BY total_balance DESC
LIMIT 10
)
SELECT
t.user_address,
TO_CHAR(t.total_balance, 'FM999,999,999,999,999,999,999') AS total_balance_per_holder,
TO_CHAR(t.total_balance * cp.price, 'FM999,999,999,999,999,999,999') AS dollar_value_per_holder,
total_total_balance AS total_balance_of_top_10,
total_total_balance * cp.price AS total_dollar_value_of_top_10 -- Change here to keep it as a number
FROM top_10_holders t
CROSS JOIN current_price cp,
(SELECT SUM(total_balance) AS total_total_balance FROM top_10_holders) AS total_holders;
QueryRunArchived: QueryRun has been archived