-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathschema.graphql
385 lines (282 loc) · 8.33 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
" Collateral auctions are used to sell collateral from Vaults that have become undercollateralized "
type CollateralAuction @entity {
id: ID!
" Collateral type "
collateral: CollateralType!
# TODO
}
" Particular collateral type registered in the system (Ilk) "
type CollateralType @entity {
" Collateral type name "
id: ID!
#
# Debt
#
" Debt ceiling [DAI] (line) "
debtCeiling: BigDecimal!
" Debt backed by this collateral type [DAI] (Art)"
debtNormalized: BigDecimal!
" Asset/DAI exchange rate (rate) "
rate: BigDecimal!
" Total assets locked as collateral"
totalCollateral: BigDecimal!
" Total debt backed by this collateral type [DAI] (Ilk.Art * rate)"
totalDebt: BigDecimal!
#
# Liquidation parameters
#
" Maximum size of collateral that can be auctioned at once (lump) "
liquidationLotSize: BigDecimal!
" Liquidation penalty (chop) "
liquidationPenalty: BigDecimal!
" Min collateralization ratio "
liquidationRatio: BigDecimal!
#
# Collateral auctions
#
" Collateral auctions for this collateral type "
auctions: [CollateralAuction!] @derivedFrom(field: "collateral")
" Number of collateral auctions started for this collateral type "
auctionCount: BigInt!
" Maximum auction duration [seconds] "
auctionDuration: BigInt!
" Max bid duration in a collateral auction [seconds] "
bidDuration: BigInt!
" Minimum bid increase in a collateral auction "
minimumBidIncrease: BigDecimal!
#
# Stability rates
#
" Stability fee rate per second "
stabilityFee: BigDecimal!
#
# Vaults
#
" Collateral auctions for this collateral type "
vaults: [Vault!] @derivedFrom(field: "collateralType")
" Min debt per vault [DAI] (dust) "
vaultDebtFloor: BigDecimal!
" Number of vaults opened through the manager (CdpManager) "
vaultCount: BigInt!
" Number of vaults NOT opened through the manager (CdpManager) "
unmanagedVaultCount: BigInt!
#
# Asset price
#
" Current market price [USD] "
price: CollateralPrice
" Price history "
prices: [CollateralPrice!] @derivedFrom(field: "collateral")
#
# Status fields
#
" Timestamp of the block in which this collateral type was added [seconds] "
addedAt: BigInt!
" Block number in which this collateral type was added "
addedAtBlock: BigInt!
" Transaction hash in which this collateral type was added "
addedAtTransaction: Bytes!
" Timestamp of the block in which this collateral type was last modified [seconds] "
modifiedAt: BigInt
" Block number in which this collateral type was last modified "
modifiedAtBlock: BigInt
" Transaction hash in which this collateral type was last modified "
modifiedAtTransaction: Bytes
}
" Collateral market price at a given block "
type CollateralPrice @entity {
" Equals to: <block_number>-<ilk>"
id: ID!
" Block number "
block: BigInt!
" Collateral type "
collateral: CollateralType!
" Market price with safety margin (current price less liquidation ratio) [USD] (spot) "
spotPrice: BigDecimal!
" Timestamp in seconds "
timestamp: BigInt!
" Price value "
value: BigDecimal!
}
" Vault owner "
type User @entity {
" Equals to account address "
id: ID!
" Account address "
address: Bytes!
" Number of user proxies associated to the user "
proxyCount: BigInt!
" Number of vaults opened by the user "
vaultCount: BigInt!
" User proxies. Up to one per collateral type "
proxies: [UserProxy!] @derivedFrom(field: "owner")
" User's vaults "
vaults: [Vault!] @derivedFrom(field: "owner")
}
" Contract used to execute transactions and sequences of transactions on behalf of a user "
type UserProxy @entity {
" Proxy address "
id: ID!
" Proxy contract address "
address: Bytes!
" Cache contract address "
cache: Bytes!
" User reference "
owner: User!
}
" Provide information about the current system state and parameters "
type SystemState @entity {
" Singleton entity. Equals to 'current' "
id: ID!
#
# General protocol stats
#
" Total debt issued [DAI] (Vat.debt)"
totalDebt: BigDecimal!
#
# About number of entities registered system-wide
#
" Number of collateral types registered "
collateralCount: BigInt!
" Number of collateral auctions started "
collateralAuctionCount: BigInt!
" Number of user proxies created "
userProxyCount: BigInt!
" Number of vaults NOT opened through the manager (CdpManager) "
unmanagedVaultCount: BigInt!
" Number of vaults opened through the manager (CdpManager) "
vaultCount: BigInt!
#
# General system parameters
#
" Base rate for stability fee per second "
baseStabilityFee: BigDecimal!
" Dai Savings Rate "
savingsRate: BigDecimal!
" Total Debt Ceiling "
totalDebtCeiling: BigDecimal!
#
# Debt auction parameters (flop)
#
" Max bid duration / single bid lifetime [seconds] "
debtAuctionBidDuration: BigInt
" The fixed debt quantity to be covered by any one debt auction [DAI] "
debtAuctionBidSize: BigDecimal
" Debt auction delay [seconds] "
debtAuctionDelay: BigInt
" Maximum auction duration [seconds] "
debtAuctionDuration: BigInt
" The starting amount of MKR offered to cover the lot [MKR] "
debtAuctionInitialLotSize: BigDecimal
" Lot size increase "
debtAuctionLotSizeIncrease: BigDecimal
" Minimum bid increase "
debtAuctionMinimumBidIncrease: BigDecimal
#
# Surplus auction parameters (flap)
#
" Max bid duration / bid lifetime [seconds] "
surplusAuctionBidDuration: BigInt
" Surplus buffer, must be exceeded before surplus auctions are possible [DAI] "
surplusAuctionBuffer: BigDecimal
" Maximum auction duration [seconds] "
surplusAuctionDuration: BigInt
" The fixed surplus quantity to be sold by any one surplus auction [DAI] "
surplusAuctionLotSize: BigDecimal
" Minimum bid increase "
surplusAuctionMinimumBidIncrease: BigDecimal
#
# Status fields
#
" The latest block in which a system parameters was modified "
block: BigInt!
" The latest timestamp in which a system parameters was modified "
timestamp: BigInt!
" The latest transaction hash in which a system parameters was modified "
transaction: Bytes!
}
" Maker Vault (formerly collateralized debt position or CDPs) "
type Vault @entity {
" Equals to: <urn>-<ilk>"
id: ID!
" CDP ID if this vault was created through the manager (CdpManager) "
cdpId: BigInt
" Collateral type associated to this vault (ilk) "
collateralType: CollateralType!
" Assets locked as collateral (ink) "
collateral: BigDecimal!
" Outstanding debt (art) [DAI] "
debt: BigDecimal!
" Address of this vault's UrnHandler instance "
handler: Bytes!
" Address of vault's owner "
owner: User!
" Timestamp of the block in which this vault was opened [seconds] "
openedAt: BigInt!
" Block number in which this vault was opened "
openedAtBlock: BigInt!
" Transaction hash in which this vault was opened "
openedAtTransaction: Bytes!
" Timestamp of the block in which this vault was last modified [seconds] "
modifiedAt: BigInt
" Block number in which this vault was last modified "
modifiedAtBlock: BigInt
" Transaction hash in which this vault was last modified "
modifiedAtTransaction: Bytes
" Vault action history "
logs: [VaultLog!] @derivedFrom(field: "vault")
}
interface VaultLog {
vault: Vault!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
type VaultCreationLog implements VaultLog @entity {
id: ID!
vault: Vault!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
type VaultCollateralChangeLog implements VaultLog @entity {
id: ID!
vault: Vault!
collateralBefore: BigDecimal!
collateralAfter: BigDecimal!
collateralDiff: BigDecimal!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
type VaultDebtChangeLog implements VaultLog @entity {
id: ID!
vault: Vault!
debtBefore: BigDecimal!
debtAfter: BigDecimal!
debtDiff: BigDecimal!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
type VaultSplitChangeLog
@entity { # implements VaultLog @entity {
id: ID!
#vault: Vault!
src: Bytes!
dst: Bytes!
collateralToMove: BigDecimal!
debtToMove: BigDecimal!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
type VaultTransferChangeLog implements VaultLog @entity {
id: ID!
vault: Vault!
previousOwner: User!
nextOwner: User!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}