-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetrics.graphql
More file actions
113 lines (103 loc) · 2.84 KB
/
Copy pathmetrics.graphql
File metadata and controls
113 lines (103 loc) · 2.84 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# 📊 Lido Protocol & User GraphQL Queries
# Run these queries in your Ponder GraphQL Playground (http://localhost:42069/graphql)
# ==========================================
# PART 1: PROTOCOL METRICS (DASHBOARD)
# ==========================================
# 1. Snapshot: Current Protocol Health
query ProtocolHealth {
liquidStakingProtocols(limit: 1) {
items {
totalValueLockedETH
totalValueLockedUSD
totalPoolCount
totalStakerCount
lastUpdatedTimestamp
}
}
}
# 2. Trends: Daily APY & TVL Evolution
query DailyAPYandTVL {
poolDailySnapshots(orderBy: "timestamp", orderDirection: "desc", limit: 30) {
items {
date
rewardAPY
totalValueLockedETH
totalSupply
dailyVolumeETH
}
}
}
# 3. Financials: Protocol Revenue
query FinancialsHistory {
financialsDailySnapshots(orderBy: "timestamp", orderDirection: "desc", limit: 30) {
items {
date
totalValueLockedUSD
dailyTotalRevenueUSD
cumulativeTotalRevenueUSD
dailyProtocolSideRevenueUSD
}
}
}
# ==========================================
# PART 2: USER WIDGETS & TRACKING
# ==========================================
# 4. Widget: "My Staking Position"
# Shows a specific user's balance and lifetime stats.
# Replace $userId with the lowercase address (e.g. "0x123...").
query MyPortfolio($userId: String!) {
accountPosition(id: $userId) {
balance # Current shares balance (need to multiply by exchange rate for ETH value)
totalDeposited # Lifetime ETH deposited
totalWithdrawn # Lifetime ETH withdrawn
depositCount
firstDepositTimestamp
lastActivityTimestamp
}
}
# 5. Widget: "My Activity Feed"
# Fetches recent actions for a specific user.
query MyActivityFromDeposits($user: String!) {
deposits(where: { from: $user }, orderBy: "timestamp", orderDirection: "desc", limit: 10) {
items {
hash
amount
timestamp
blockNumber
}
}
}
query MyActivityFromWithdrawals($user: String!) {
withdraws(where: { from: $user }, orderBy: "timestamp", orderDirection: "desc", limit: 10) {
items {
hash
amount
timestamp
blockNumber
}
}
}
# 6. Widget: "Whale Leaderboard"
# Shows top stakers by balance. Great for gamification/analysis.
# Note: Balance here is raw shares. To get ETH amount, multiply by current Exchange Rate from ProtocolHealth.
query TopStakers {
accountPositions(orderBy: "balance", orderDirection: "desc", limit: 10) {
items {
account
balance
totalDeposited
}
}
}
# 7. Analytics: User Retention / Cohorts
# Analyze users based on when they first joined (First Deposit).
query UserCohorts {
accounts(orderBy: "firstDepositTimestamp", orderDirection: "asc", limit: 50) {
items {
id
firstDepositTimestamp
depositCount
lastActivityTimestamp
}
}
}