hessTotal Walkers and mint
Updated 2023-08-15
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
›
⌄
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),
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 > '2023-01-01'),
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 )
select count(DISTINCT(owner_id)) as user,
sum(amount) as amounts, avg(amount) as average , median(amount) as median,
max(amount) as max_amount, min(amount) as min_amount
from transfer
where event = 'ft_mint' and new_owner_id IS NULL
and to_address IN (SELECT distinct tx_receiver FROM sweat_wallet)
and block_timestamp >= '2023-01-01'
Run a query to Download Data