hessUsers Breakdown
Updated 2024-08-16
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 wallet as ( select trunc(block_timestamp,'day') as date,
tx_receiver ,
deposit/pow(10,24) as near_amount
from near.core.fact_Transfers
where (tx_signer ilike '%sweat_welcome.near%' or tx_signer ilike '%sweat_oracle_%' ) and status = 'TRUE'
and tx_receiver not in ('sweat_welcome.near'))
,
sweat_wallet as ( select tx_receiver
from wallet
where near_amount <= 0.05),
----- THIS PART OF CODE CREDITED TO PINEHEARST
logs AS ( select block_timestamp,
replace(value, 'EVENT_JSON:') as json,
try_parse_json(json):event as event,
regexp_substr(status_value, 'Success') as success,
try_parse_json(json):data as data_logs
from near.core.fact_receipts, table(flatten(input => logs))
where receiver_id = 'token.sweat' and success is not null
and block_timestamp::date > CURRENT_DATE - 14),
transfer as ( select block_timestamp,
value:amount/pow(10,18) as amount,
value:owner_id as owner_id,
value:old_owner_id as old_owner_id,
value:new_owner_id as new_owner_id, event,
nvl(old_owner_id, 'mint') as from_address, nvl(new_owner_id, owner_id) as to_address
from logs, table(flatten(input => data_logs))
where amount > 0 )
,
final as ( select owner_id,
sum(amount) as amounts,
avg(amount) as average ,
median(amount) as median,
max(amount) as max_amount,
min(amount) as min_amount
QueryRunArchived: QueryRun has been archived