hessStaked Sweat
Updated 2023-02-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
36
›
⌄
with logs AS (
SELECT
block_timestamp,
tx_hash,
status_value,
replace(value, 'EVENT_JSON:') as json,
regexp_substr(status_value, 'Success') as reg_success,
try_parse_json(json):standard as standard,
try_parse_json(json):event as event,
try_parse_json(json):data as data_logs
FROM near.core.fact_receipts,
table(flatten(input => logs))
WHERE 1=1
AND receiver_id = 'token.sweat'
AND reg_success is not null
and block_timestamp >= CURRENT_DATE - 14
),
sweat_transfer AS (
SELECT
block_timestamp,
tx_hash,
standard,
event,
value:amount/pow(10,18) as amount,
value:owner_id as owner_id,
value:old_owner_id as old_owner_id, -- ft_transfer
value:new_owner_id as new_owner_id, -- ft_transfer
-- case when event = 'ft_mint' then 'mint' when event = 'ft_transfer' then old_owner_id else 'null' end as from_address,
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
),
new_stakers AS (
SELECT
Run a query to Download Data