superflyTerra Richlist
Updated 2022-12-26Copy 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
›
⌄
with
received as (
SELECT
receiver,
sum(cast(amount as int)) as total_received
FROM
terra.core.ez_transfers
WHERE tx_succeeded = TRUE AND currency = 'uluna'
GROUP BY 1
),
sent as (
SELECT
sender,
sum(cast(amount as int)) total_sent
FROM
terra.core.ez_transfers
WHERE tx_succeeded = TRUE AND currency = 'uluna'
GROUP BY 1
)
SELECT
address,
(total_received - total_sent) as balance
FROM
(SELECT
receiver as address,
total_received,
total_sent
FROM
received a
LEFT JOIN sent b ON a.receiver = b.sender)
LIMIT 100
Run a query to Download Data