forked from OlympusDAO/olympus-protocol-metrics-subgraph
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.graphql
183 lines (167 loc) · 4.18 KB
/
schema.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
type DailyBond @entity {
id: ID!
timestamp: BigInt!
token: Token!
amount: BigDecimal!
value: BigDecimal!
}
type Rebase @entity {
id: ID!
amount: BigDecimal!
stakedOhms: BigDecimal!
percentage: BigDecimal!
contract: String!
timestamp: BigInt!
value: BigDecimal!
}
type DailyStakingReward @entity {
id: ID!
timestamp: BigInt!
amount: BigDecimal!
value: BigDecimal!
}
type Token @entity {
id: ID!
}
# Stores easily-calculated metrics related to the Olympus protocol
type ProtocolMetric @entity {
id: ID! # YYYY-MM-DD
block: BigInt!
currentAPY: BigDecimal!
currentIndex: BigDecimal!
date: String! # YYYY-MM-DD
gOhmPrice: BigDecimal!
gOhmSyntheticSupply: BigDecimal
gOhmTotalSupply: BigDecimal!
marketCap: BigDecimal
nextDistributedOhm: BigDecimal!
nextEpochRebase: BigDecimal!
ohmCirculatingSupply: BigDecimal
ohmFloatingSupply: BigDecimal
ohmPrice: BigDecimal!
ohmTotalSupply: BigDecimal!
sOhmCirculatingSupply: BigDecimal! # Returned by the sOHM contract, so can be included here
timestamp: BigInt! # Unix timestamp in UTC
totalValueLocked: BigDecimal!
treasuryLiquidBacking: BigDecimal
treasuryLiquidBackingPerGOhmSynthetic: BigDecimal
treasuryLiquidBackingPerOhmFloating: BigDecimal
treasuryMarketValue: BigDecimal
}
type BondDiscount @entity {
id: ID!
timestamp: BigInt!
dai_discount: BigDecimal!
ohmdai_discount: BigDecimal!
frax_discount: BigDecimal!
ohmfrax_discount: BigDecimal!
eth_discount: BigDecimal!
lusd_discount: BigDecimal!
ohmlusd_discount: BigDecimal!
}
# Represents the balance of a specific token in the treasury
type TokenRecord @entity {
id: ID! # YYYY-MM-DD/<source>/<token>
block: BigInt!
timestamp: BigInt! # Unix timestamp in UTC
date: String!
token: String!
tokenAddress: String!
source: String!
sourceAddress: String!
rate: BigDecimal!
balance: BigDecimal!
multiplier: BigDecimal!
value: BigDecimal! # Calculated
valueExcludingOhm: BigDecimal! # Calculated
category: String!
isLiquid: Boolean!
isBluechip: Boolean!
blockchain: String!
}
# Represents a balance that affects the supply of OHM
type TokenSupply @entity {
id: ID! # YYYY-MM-DD/<token>/<type>/<pool>/<source>
block: BigInt!
timestamp: BigInt! # Unix timestamp in UTC
date: String! # YYYY-MM-DD
token: String!
tokenAddress: String!
pool: String
poolAddress: String
source: String # e.g. a wallet
sourceAddress: String
type: String! # e.g. total supply
balance: BigDecimal!
supplyBalance: BigDecimal! # may be negative to represent the token being taken out of circulation
}
type PriceSnapshot @entity(immutable: true) {
id: ID!
block: BigInt!
timestamp: BigInt!
date: String!
priceOhm: BigDecimal!
priceGOhm: BigDecimal!
}
# Should be a single entry
# Used for tracking markets
type GnosisAuctionRoot @entity {
id: ID!
markets: [BigInt!]!
}
type GnosisAuction @entity {
id: ID!
auctionOpenTimestamp: BigInt!
payoutCapacity: BigDecimal!
termSeconds: BigInt!
bidQuantity: BigDecimal # Is set later, so should not be required
auctionCloseTimestamp: BigInt
}
# Caching
type ERC20TokenSnapshot @entity(immutable: true) {
id: ID! # address/block
address: Bytes!
decimals: Int!
totalSupply: BigDecimal
}
type ConvexRewardPoolSnapshot @entity(immutable: true) {
id: ID! # lowercase address/block
block: BigInt!
address: Bytes!
stakingToken: Bytes!
}
# TODO migrate to PoolSnapshot
type BalancerPoolSnapshot @entity(immutable: true) {
id: ID! # pool id/block
block: BigInt!
pool: Bytes!
poolToken: Bytes!
decimals: Int!
totalSupply: BigDecimal!
tokens: [Bytes!]!
balances: [BigDecimal!]!
weights: [BigDecimal!]!
}
type PoolSnapshot @entity(immutable: true) {
id: ID! # pool/block
block: BigInt!
pool: Bytes!
poolToken: Bytes
decimals: Int!
totalSupply: BigDecimal!
tokens: [Bytes!]!
balances: [BigDecimal!]!
weights: [BigDecimal!]
}
type TokenPriceSnapshot @entity(immutable: true) {
id: ID! # address/block
block: BigInt!
token: Bytes!
price: BigDecimal!
}
type StakingPoolSnapshot @entity(immutable: true) {
id: ID! # address/block
block: BigInt!
contractAddress: Bytes!
stakingToken: Bytes # Will not be set if the call reverts
}