forked from ark4n631/contracts-events
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathschema.graphql
More file actions
577 lines (538 loc) · 14.7 KB
/
schema.graphql
File metadata and controls
577 lines (538 loc) · 14.7 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
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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
enum ConsensusContract {
LoanTermsConsensus
InterestConsensus
}
enum LendingPoolAction {
Deposited
Withdrawn
Repaid
InterestWithdrawn
PaymentLiquidated
}
enum LoanStatus {
TermsSet
Active
Closed
}
enum TokenStatusAction {
Transfer
Approval
MinterAdded
MinterRemoved
}
type EthTransaction @entity {
id: ID!
event: String!
from: Bytes!
gasPrice: BigInt!
gasSent: BigInt!
hash: Bytes!
index: BigInt!
to: Bytes!
value: BigInt!
contract: Bytes!
timestamp: BigInt!
gasLimit: BigInt!
blockNumber: BigInt!
}
type Borrower @entity {
id: ID!
address: Bytes!
loans: [Loan!]! @relation
}
type Loan @entity {
id: ID!
token: String!
collateralToken: String!
transaction: EthTransaction!
borrower: Borrower!
recipient: Bytes!
terms: LoanTerm!
startDate: BigInt! # https://github.com/graphql/graphql-js/issues/1003#issuecomment-324790647
endDate: BigInt!
amountBorrowed: BigInt!
"Current loan status."
status: LoanStatus!
"All the repayments made to this loan."
repayments: [LoanRepayment!]!
totalRepaidAmount: BigInt!
totalOwedAmount: BigInt!
collateralDeposits: [CollateralDeposit!]!
totalCollateralDepositsAmount: BigInt!
collateralWithdrawns: [CollateralWithdraw!]!
totalCollateralWithdrawalsAmount: BigInt!
liquidation: Liquidation
"Represents the escrow contract that is created when the loan is taken out by the borrower or recipient. A loan can have only one escrow."
escrow: Escrow
"Blocknumber the loan was most recently updated."
blockNumber: BigInt!
"Timestamp the loan was most recently updated."
timestamp: BigInt!
}
####################################################################################
#
# It contains the Escrow information related to a given loan (after it was taken out).
#
####################################################################################
type Escrow @entity {
"It includes the market (borrowed and collateral token names) and loan ID. See Loan#ID field."
id: ID!
"The ETH transaction when the escrow was created (loan was taken out)."
transaction: EthTransaction!
"The loan reference to which this escrow is associated to."
loan: Loan! @relation
"Blocknumber the escrow was most recently updated."
blockNumber: BigInt!
"Timestamp the escrow was most recently updated."
timestamp: BigInt!
}
type LoanTerm @entity {
id: ID! # LoanID
transaction: EthTransaction!
interestRate: BigInt!
collateralRatio: BigInt!
maxLoanAmount: BigInt!
duration: BigInt!
expiryAt: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type Liquidation @entity {
id: ID! # LoanID
transaction: EthTransaction!
loan: Loan!
liquidator: Bytes!
collateralOut: BigInt!
tokensIn: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type LoanRepayment @entity {
id: ID!
transaction: EthTransaction!
loan: Loan!
amount: BigInt!
payer: Bytes!
blockNumber: BigInt!
timestamp: BigInt!
}
type CollateralDeposit @entity {
id: ID!
transaction: EthTransaction!
loan: Loan!
borrower: Borrower!
amount: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type CollateralWithdraw @entity {
id: ID!
transaction: EthTransaction!
loan: Loan!
borrower: Borrower!
amount: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type LendingPoolStatus @entity {
id: ID!
platformToken: String!
lendingToken: String!
collateralToken: String!
amount: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type LendingPoolChange @entity {
id: ID!
platformToken: String!
lendingToken: String!
collateralToken: String!
transaction: EthTransaction!
address: Bytes!
amount: BigInt!
action: LendingPoolAction!
blockNumber: BigInt!
timestamp: BigInt!
}
type InterestSubmitted @entity {
id: ID!
token: String!
collateralToken: String!
transaction: EthTransaction!
signer: Bytes!
lender: Bytes!
requestNonce: BigInt!
interest: BigInt!
endTime: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type InterestAccepted @entity {
id: ID!
token: String!
collateralToken: String!
transaction: EthTransaction!
lender: Bytes!
requestNonce: BigInt!
endTime: BigInt!
interest: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
####################################################################################
#
# It contains all the loan terms submitted by the signers.
#
####################################################################################
type LoanTermsSubmitted @entity {
"An unique ID."
id: ID!
"The lending/borrowed token name."
token: String!
"The collateral token name."
collateralToken: String!
"The reference to the ETH transaction."
transaction: EthTransaction!
"The signer address."
signer: Bytes!
"The borrower address."
borrower: Bytes!
"The request nonce used in the loan terms."
requestNonce: BigInt!
"The signer nonce used in this loan terms."
signerNonce: BigInt!
"The interest rate accepted."
interestRate: BigInt!
"The collateral ratio accepted."
collateralRatio: BigInt!
"The max loan amount accepted."
maxLoanAmount: BigInt!
"Blocknumber where the transaction was executed."
blockNumber: BigInt!
"Timestamp when the transaction was executed."
timestamp: BigInt!
}
type LoanTermsAccepted @entity {
id: ID!
token: String!
collateralToken: String!
transaction: EthTransaction!
borrower: Bytes!
requestNonce: BigInt!
interestRate: BigInt!
collateralRatio: BigInt!
maxLoanAmount: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type AccruedInterestChange @entity {
id: ID!
token: String!
collateralToken: String!
transaction: EthTransaction!
lender: Bytes!
totalNotWithdrawn: BigInt!
totalAccruedInterest: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
type AccruedInterestWithdrawalChange @entity {
id: ID!
token: String!
collateralToken: String!
transaction: EthTransaction!
recipient: Bytes!
amount: BigInt!
blockNumber: BigInt!
timestamp: BigInt!
}
####################################################################################
#
# It contains the last tToken holder balances.
# Each row represents the current holder balance for a given tToken.
#
####################################################################################
type TTokenHolderBalancesStatus @entity {
"TToken address and holder address."
id: ID!
"Current holder balance for the given platform token (tToken)."
balance: BigInt!
"TToken symbol"
platformToken: String!
"Holder address."
holder: Bytes!
"Blocknumber the holder balance was most recently updated."
blockNumber: BigInt!
"Timestamp the holder balance was most recently updated."
updatedAt: BigInt!
}
####################################################################################
#
# It contains all the tToken changes (like transfers, approvals).
# Each change (transaction) represents a row in the entity.
#
####################################################################################
type TTokenHolderActionsChange @entity {
"Transaction hash and event index."
id: ID!
"Transaction info about the change."
transaction: EthTransaction!
"TToken amount involved in the transaction."
amount: BigInt!
"The TToken name involved in the transaction."
platformToken: String!
"TToken holder address that sent the transaction."
from: Bytes!
"Address that received the change."
to: Bytes!
"Enum that identifies the token action."
action: TokenStatusAction!
"Blocknumber where the transaction was executed."
blockNumber: BigInt!
"Timestamp when the transaction was executed."
timestamp: BigInt!
}
type PlatformSettingsStatus @entity {
id: ID!
settingName: String!
value: BigInt!
min: BigInt!
max: BigInt!
removed: Boolean!
blockNumber: BigInt!
timestamp: BigInt!
}
type PlatformSettingsChange @entity {
id: ID!
transaction: EthTransaction!
oldValue: BigInt!
newValue: BigInt!
from: Bytes!
settingName: String!
blockNumber: BigInt!
timestamp: BigInt!
}
type LendingPoolPauseStatus @entity {
id: ID!
lendingPool: Bytes!
paused: Boolean!
blockNumber: BigInt!
timestamp: BigInt!
}
type LendingPoolPauseChange @entity {
id: ID!
transaction: EthTransaction!
paused: Boolean!
lendingPool: Bytes!
from: Bytes!
blockNumber: BigInt!
timestamp: BigInt!
}
type SignerStatus @entity {
id: ID!
token: String!
collateralToken: String!
contract: ConsensusContract!
account: Bytes!
removed: Boolean!
blockNumber: BigInt!
timestamp: BigInt!
}
type SignerChange @entity {
id: ID!
token: String!
collateralToken: String!
contract: ConsensusContract!
transaction: EthTransaction!
account: Bytes!
removed: Boolean!
blockNumber: BigInt!
timestamp: BigInt!
}
type PauserStatus @entity {
id: ID!
account: Bytes!
active: Boolean!
blockNumber: BigInt!
timestamp: BigInt!
}
type PauserChange @entity {
id: ID!
transaction: EthTransaction!
account: Bytes!
active: Boolean!
blockNumber: BigInt!
timestamp: BigInt!
}
type AssetSettingsStatus @entity {
id: ID!
tokenAddress: Bytes!
cTokenAddress: Bytes!
maxLoanAmount: BigInt!
removed: Boolean!
timestamp: BigInt!
blockNumber: BigInt!
}
type AssetSettingsChange @entity {
id: ID!
sender: Bytes!
tokenAddress: Bytes!
propertyChanged: String!
oldValue: String!
newValue: String!
timestamp: BigInt!
blockNumber: BigInt!
}
type BorrowerNoncesChange @entity {
id: ID!
token: String!
collateralToken: String!
borrower: Bytes!
nonce: BigInt!
timestamp: BigInt!
blockNumber: BigInt!
}
type LenderNoncesChange @entity {
id: ID!
token: String!
collateralToken: String!
lender: Bytes!
nonce: BigInt!
timestamp: BigInt!
blockNumber: BigInt!
}
####################################################################################
#
# It contains the total values (supply, and lent) per TToken asset.
#
####################################################################################
type TTokenTotalValuesStatus @entity {
"It is the TToken address."
id: ID!
"The TToken address."
ttoken: Bytes!
"The current total supply for the given TToken."
totalSupply: BigInt!
"The current total lent for the given TToken."
totalLent: BigInt!
"The current total repaid amount for the given TToken."
totalRepaid: BigInt!
"Blocknumber the total supply was most recently updated."
blockNumber: BigInt!
"Timestamp the total supply was most recently updated."
timestamp: BigInt!
}
####################################################################################
#
# It contains the total values (supply, repaid and lent) per TToken asset for a given block number.
#
####################################################################################
type TTokenTotalValuesChange @entity {
"It includes transaction hash and event log index."
id: ID!
"The ETH transaction where an amount was modified."
transaction: EthTransaction!
"The sender address."
sender: Bytes!
"The TToken address."
ttoken: Bytes!
"The total supply for the given TToken and block number."
totalSupply: BigInt!
"The total lent for the given TToken and block number."
totalLent: BigInt!
"The total repaid amount for the given TToken and block number."
totalRepaid: BigInt!
"Blocknumber when the total values were updated."
blockNumber: BigInt!
"Timestamp the total total values were updated."
timestamp: BigInt!
}
####################################################################################
#
# It contains the current pair aggregators used in the platform.
#
####################################################################################
type PairAggregatorsStatus @entity {
"It includes the pair (base/quote) address."
id: ID!
"This is the base token (ERC20) address."
baseToken: Bytes!
"This is the base token (ERC20) symbol."
baseTokenSymbol: String!
"This is the quote token (ERC20) address."
quoteToken: Bytes!
"This is the quote token (ERC20) symbol."
quoteTokenSymbol: String!
"This is the pair aggregator address (proxy address)."
aggregator: Bytes!
"The decimals included in the oracle response."
responseDecimals: BigInt!
"The decimals included in the collateral token."
collateralDecimals: BigInt!
"It defines if this pair aggregator is inverse."
inverse: Boolean!
"Blocknumber the pair aggregator (baseToken and quoteToken) was most recently updated."
blockNumber: BigInt!
"Timestamp the pair aggregator (baseToken and quoteToken) was most recently updated."
timestamp: BigInt!
}
####################################################################################
#
# It contains the current pair aggregators used in the platform.
#
####################################################################################
type PairAggregatorsChange @entity {
"It includes transaction hash and event log index."
id: ID!
"The ETH transaction when the pair aggregator was registered."
transaction: EthTransaction!
"Address that created this pair aggregator."
creator: Bytes!
"This is the base token (ERC20) address."
baseToken: Bytes!
"This is the base token (ERC20) symbol."
baseTokenSymbol: String!
"This is the quote token (ERC20) address."
quoteToken: Bytes!
"This is the quote token (ERC20) symbol."
quoteTokenSymbol: String!
"This is the pair aggregator address (proxy address)."
aggregator: Bytes!
"The decimals included in the oracle response."
responseDecimals: BigInt!
"The decimals included in the collateral token."
collateralDecimals: BigInt!
"It defines if this pair aggregator is inverse."
inverse: Boolean!
"Blocknumber the pair aggregator (baseToken and quoteToken) was most recently updated."
blockNumber: BigInt!
"Timestamp the pair aggregator (baseToken and quoteToken) was most recently updated."
timestamp: BigInt!
}
####################################################################################
#
# It contains the all the changes for the tToken holder balances (transfer events).
# Each row represents the current holder balance for a given tToken and block number.
#
####################################################################################
type TTokenHolderBalancesChange @entity {
"TToken address and holder address."
id: ID!
"The ETH transaction when transfer event was emitted."
transaction: EthTransaction!
"TToken address."
token: Bytes!
"TToken name."
tokenName: String!
"Current holder balance for the given token and holder."
balance: BigInt!
"Amount used in this transaction for the given token and holder. It is a negative value if the sender is the holder, and a positive value if the holder received a transfer."
amount: BigInt!
"Holder address."
holder: Bytes!
"Blocknumber the holder balance was most recently updated."
blockNumber: BigInt!
"Timestamp the holder balance was most recently updated."
timestamp: BigInt!
}