Metric | USER_COUNT | PERCENTAGE | |
---|---|---|---|
1 | Repeat Stakers | 77 | 30.7 |
2 | Dormant Stakers | 192 | 76.5 |
3 | One-Time Stakers | 174 | 69.3 |
4 | Total Stakers | 251 | 100 |
FatemeTheLady03 User Loyalty
Updated 7 days ago
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 user_activity AS (
SELECT
decoded_log:owner::STRING AS user_address,
COUNT(DISTINCT CASE WHEN EVENT_NAME = 'Deposit' THEN tx_hash END) AS deposit_count,
MAX(block_timestamp) AS last_activity_date,
DATEDIFF('day', MAX(block_timestamp), CURRENT_DATE()) AS days_inactive
FROM avalanche.core.fact_decoded_event_logs
WHERE contract_address = LOWER('0x06d47f3fb376649c3a9dafe069b3d6e35572219e')
AND EVENT_NAME IN ('Deposit')
GROUP BY user_address
),
loyalty_stats AS (
SELECT
COUNT(DISTINCT user_address) AS total_users,
COUNT(DISTINCT CASE WHEN deposit_count > 1 THEN user_address END) AS repeat_users,
COUNT(DISTINCT CASE WHEN days_inactive >= 30 THEN user_address END) AS dormant_users
FROM user_activity
)
SELECT
'Repeat Stakers' AS "Metric",
repeat_users AS user_count,
ROUND((repeat_users * 100.0) / NULLIF(total_users, 0), 1) AS percentage
FROM loyalty_stats
UNION ALL
SELECT
'Dormant Stakers' AS "Metric",
dormant_users AS user_count,
ROUND((dormant_users * 100.0) / NULLIF(total_users, 0), 1) AS percentage
FROM loyalty_stats
UNION ALL
SELECT
'One-Time Stakers' AS "Metric",
(total_users - repeat_users) AS user_count,
ROUND(((total_users - repeat_users) * 100.0) / NULLIF(total_users, 0), 1) AS percentage
Last run: 7 days ago
4
113B
3s