forked from messari/subgraphs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema-metrics.graphql
137 lines (101 loc) · 3.13 KB
/
schema-metrics.graphql
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Subgraph Schema: Metrics
# Version: 1.1.0
enum Network {
ARBITRUM
AURORA
AVALANCHE
BSC
CELO
CRONOS
ETHEREUM
FANTOM
HARMONY
MOONBEAM
MOONRIVER
OPTIMISM
POLYGON
XDAI
}
enum ProtocolType {
EXCHANGE
LENDING
YIELD
BRIDGE
GENERIC
# Will add more
}
#############################
##### Protocol Metadata #####
#############################
type Protocol @entity {
" Smart contract address of the protocol's main contract (Factory, Registry, etc) "
id: ID!
" Name of the protocol, including version. e.g. Uniswap v3 "
name: String!
" Slug of protocol, including version. e.g. uniswap-v3 "
slug: String!
" Version of the subgraph schema, in SemVer format (e.g. 1.0.0) "
schemaVersion: String!
" Version of the subgraph implementation, in SemVer format (e.g. 1.0.0) "
subgraphVersion: String!
" Version of the methodology used to compute metrics, loosely based on SemVer format (e.g. 1.0.0) "
methodologyVersion: String!
network: Network!
type: ProtocolType!
" # of total/cumulative unique users "
totalUniqueUsers: Int!
totalValueLockedUSD: BigDecimal!
" Total volume in USD "
totalVolumeUSD: BigDecimal!
usageMetrics: [UsageMetricsDailySnapshot!]! @derivedFrom(field: "protocol")
financialMetrics: [FinancialsDailySnapshot!]! @derivedFrom(field: "protocol")
}
###############################
##### Protocol Timeseries #####
###############################
type UsageMetricsDailySnapshot @entity {
" ID is # of days since Unix epoch time "
id: ID!
protocol: Protocol!
" # of unique daily active users "
activeUsers: Int!
" # of total/cumulative unique users "
totalUniqueUsers: Int!
" Total number of transaction occurred in a day. Transactions include all entities that implement the Event interface. "
dailyTransactionCount: Int!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
}
type FinancialsDailySnapshot @entity {
" ID is # of days since Unix epoch time "
id: ID!
protocol: Protocol!
totalValueLockedUSD: BigDecimal!
" Only relevant for protocols with PCV. "
protocolControlledValueUSD: BigDecimal
" Total volume in USD "
totalVolumeUSD: BigDecimal!
" Revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 0.25% of the swap fee in Sushiswap). Depositors on Lending Protocols. NFT sellers on OpenSea. "
supplySideRevenueUSD: BigDecimal!
" Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. "
protocolSideRevenueUSD: BigDecimal!
" Total revenue accrued by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. "
totalRevenueUSD: BigDecimal!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
}
# An account is a unique Ethereum address
# Helps to accumulate total unique users
type Account @entity {
" Address of the account "
id: ID!
}
# Helper entity for calculating daily active users
type DailyActiveAccount @entity {
" { Days since Unix epoch }-{ Address of the account } "
id: ID!
}