jackguyNEAR Distribution 2 copy
Updated 2023-03-13
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
›
⌄
WITH tab10 as (
SELECT
signer_id,
min(date_trunc('day', block_timestamp)) as first_day,
count(DISTINCT tx_hash) as profile_change_events
FROM near.social.fact_addkey_events
GROUP BY 1
), tab1 as (
SELECT
tx_receiver,
sum(deposit / power(10, 24)) as in_volume
FROM near.core.fact_transfers
GROUP BY 1
), tab2 as (
SELECT
TX_SIGNER,
sum(deposit / power(10, 24)) as out_volume
FROM near.core.fact_transfers
GROUP BY 1
), tab3 as (
SELECT
*,
in_volume - out_volume as net_balance
FROM tab1
LEFT OUTER join tab2
on tx_signer = tx_receiver
WHERE TX_SIGNER in (
SELECT
DISTINCT signer_id
FROM tab10
WHERE first_day BETWEEN '{{ user_group_first_day }}' AND '{{ user_group_last_day }}'
)
HAVING net_balance > 0
)
SELECT
Run a query to Download Data