-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathschema.graphql
1206 lines (1047 loc) · 32.4 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
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
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
type Proposal @entity {
"Proposal's unique identifier"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
createdAt: Int!
proposer: Delegate!
votes: [Vote!]!
history: [ProposalState!]
targets: [Bytes!]!
values: [BigInt!]!
calldatas: [Bytes!]!
startBlock: Int!
endBlock: Int!
isCancelled: Boolean
isQueued: Boolean
isExecuted: Boolean
}
type Vote @entity {
"Address and proposal combined as the unique identifier"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
proposal: Proposal!
delegate: Delegate!
yesToProposal: Boolean!
votingPower: BigInt!
}
type Delegate @entity {
"Ethereum address"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
sNOTEVotingPower: BigInt!
NOTEVotingPower: BigInt!
totalVotingPower: BigInt!
account: Account!
delegatedNote: [NoteBalance!] @derivedFrom(field: "delegate")
delegatedStakedNote: [StakedNoteBalance!] @derivedFrom(field: "delegate")
votingPowerChange: [VotingPowerChange!] @derivedFrom(field: "delegate")
votes: [Vote!] @derivedFrom(field: "delegate")
proposals: [Proposal!] @derivedFrom(field: "proposer")
}
enum VotingPowerSource {
sNOTE,
NOTE
}
type VotingPowerChange @entity {
"TokenAddress:TxnHash:LogIndex"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
source: VotingPowerSource!
delegate: Delegate!
votingPowerBefore: BigInt!
votingPowerAfter: BigInt!
}
type ProposalState @entity {
id: ID!
state: ProposalStateEnum!
transactionHash: Bytes!
lastUpdateTimestamp: Int!
}
enum TokenType {
"Token that is the base for a cToken or other mintable token"
UnderlyingToken
"Compound interest bearing token"
cToken
"Ether specific Compound interest bearing token"
cETH
"The one and only Ether"
Ether
"A token that cannot be minted as a cToken, but can be used as collateral or traded"
NonMintable
}
enum ProposalStateEnum {
PENDING
CANCELLED
QUEUED
EXECUTED
}
type Currency @entity {
"Auto incrementing unique numeric id"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Category of token that this refers to"
tokenType: TokenType!
"Name of the asset currency"
name: String!
"Symbol of the asset currency"
symbol: String!
"Address of asset token"
tokenAddress: Bytes!
"Decimals of the asset token"
decimals: BigInt!
"If asset token has a transfer fee"
hasTransferFee: Boolean!
"Maximum total contract balance for collateral, zero if no limit"
maxCollateralBalance: BigInt
"Name of the underlying currency"
underlyingName: String
"Symbol of the underlying currency"
underlyingSymbol: String
"Address of underlying token"
underlyingTokenAddress: Bytes
"Decimals of the underlying token"
underlyingDecimals: BigInt
"If underlying token has a transfer fee"
underlyingHasTransferFee: Boolean
"Exchange rate from this currency to Eth, used in free collateral calculations"
ethExchangeRate: EthExchangeRate! @derivedFrom(field: "baseCurrency")
"Exchange rate from this currency to the underlying asset"
assetExchangeRate: AssetExchangeRate @derivedFrom(field: "assetCurrency")
"Cash group for a currency, if exists"
cashGroup: CashGroup @derivedFrom(field: "currency")
"nToken for a currency, if exists"
nToken: nToken @derivedFrom(field: "currency")
"Incentive Migration for a currency, if exists"
incentiveMigration: IncentiveMigration @derivedFrom(field: "currency")
"Hourly data for this currency"
ethExchangeRateHistoricalData: [EthExchangeRateHistoricalData!] @derivedFrom(field: "currency")
assetExchangeRateHistoricalData: [AssetExchangeRateHistoricalData!] @derivedFrom(field: "currency")
nTokenPresentValueHistoricalData: [NTokenPresentValueHistoricalData!] @derivedFrom(field: "currency")
"Strategy vaults that use this currency as a primary borrow"
leveragedVaults: [LeveragedVault!] @derivedFrom(field: "primaryBorrowCurrency")
}
type EthExchangeRate @entity {
"Currency id that this exchange rate refers to"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Base currency in the exchange rate"
baseCurrency: Currency!
"Rate oracle that is used to reference the exchange rate"
rateOracle: Bytes!
"Decimal places of the exchange rate"
rateDecimalPlaces: Int!
"Does the exchange rate need to invert"
mustInvert: Boolean!
"Percentage buffer used when calculating free collateral for debt balances"
buffer: Int!
"Percentage haircut used when calculating free collateral for collateral balances"
haircut: Int!
"Exchange rate discount given when liquidating this currency"
liquidationDiscount: Int!
}
type AssetExchangeRate @entity {
"Currency id that this asset rate refers to"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Asset currency in the exchange rate"
assetCurrency: Currency!
"Asset rate adapter interface to the asset token"
rateAdapterAddress: Bytes!
"Decimal places of the underlying token to the asset token"
underlyingDecimalPlaces: Int!
"Asset rates that fCash assets will settle at for given maturities"
settlementRates: [SettlementRate!] @derivedFrom(field: "assetExchangeRate")
}
type SettlementRate @entity {
"Currency id and maturity that this settlement rate refers to"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Currency of this settlement rate"
currency: Currency!
"Asset exchange rate referenced by this settlement rate"
assetExchangeRate: AssetExchangeRate!
"Maturity that this settlement rate refers to"
maturity: Int!
"Settlement rate value"
rate: BigInt!
}
type CashGroup @entity {
"Currency id that this cash group refers to"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Currency of this cash group"
currency: Currency!
"Index of the AMMs on chain that will be made available."
maxMarketIndex: Int!
"Maximum length of a market maturity in seconds"
maxMarketMaturityLengthSeconds: Int!
"Time window in minutes that the rate oracle will be averaged over"
rateOracleTimeWindowSeconds: Int!
"Total fees per trade, specified in basis points"
totalFeeBasisPoints: Int!
"Share of the fees given to the protocol, denominated in percentage"
reserveFeeSharePercent: Int!
"Debt buffer specified in basis points"
debtBufferBasisPoints: Int!
"fCash haircut specified in basis points"
fCashHaircutBasisPoints: Int!
"Penalty for settling a negative cash debt in basis points"
settlementPenaltyRateBasisPoints: Int!
"Discount on fCash given to the liquidator in basis points"
liquidationfCashHaircutBasisPoints: Int!
"Discount on negative fCash given to the liquidator in basis points"
liquidationDebtBufferBasisPoints: Int!
"Liquidity token haircut applied to cash claims, specified as a percentage between 0 and 100"
liquidityTokenHaircutsPercent: [Int!]!
"Rate scalar used to determine the slippage of the market"
rateScalars: [Int!]!
"Current size of reserves accumulated for this cash group"
reserveBalance: BigInt!
"The minimum threshold of the reserve before they are harvested for buybacks"
reserveBuffer: BigInt
nToken: nToken! @derivedFrom(field: "cashGroup")
}
type nToken @entity {
"Currency id of the nToken"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Address of the nToken"
tokenAddress: Bytes!
name: String!
symbol: String!
decimals: BigInt!
totalSupply: BigInt!
integralTotalSupply: BigInt!
accumulatedNOTEPerNToken: BigInt
lastSupplyChangeTime: BigInt!
"Cash group that governs this nToken"
cashGroup: CashGroup!
"Currency of this nToken"
currency: Currency!
"Proportion of deposits that go into each corresponding market"
depositShares: [Int!]
"Maximum market proportion that the nToken will provide liquidity at"
leverageThresholds: [Int!]
"Annualized anchor rates used during market initialization"
annualizedAnchorRates: [Int!]
"Market proportions used during market initialization"
proportions: [Int!]
"Annual incentive emission rate"
incentiveEmissionRate: BigInt
"Residual purchase incentive in basis points"
residualPurchaseIncentiveBasisPoints: Int
"Seconds until residuals become available to purchase after market initialization"
residualPurchaseTimeBufferSeconds: Int
"Basis points of cash withholding for negative fCash"
cashWithholdingBufferBasisPoints: Int
"Percentage of the nToken PV that is used during free collateral"
pvHaircutPercentage: Int
"Discount on nToken PV given to liquidators"
liquidationHaircutPercentage: Int
"Link to the nToken account object"
account: Account @derivedFrom(field: "nToken")
}
type GlobalTransferOperator @entity {
"Address of the global transfer operator"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
}
type AuthorizedCallbackContract @entity {
"Address of the callback contract"
id: ID!
name: String!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
}
type SecondaryIncentiveRewarder @entity {
"Address of the rewarder contract"
id: ID!
currency: Currency!
nToken: nToken!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
}
enum AssetType {
fCash
LiquidityToken_3Month
LiquidityToken_6Month
LiquidityToken_1Year
LiquidityToken_2Year
LiquidityToken_5Year
LiquidityToken_10Year
LiquidityToken_20Year
}
type Account @entity {
"Account address"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Timestamp of the next time that the account will require settlement"
nextSettleTime: BigInt!
"True if the account's portfolio has debt assets"
hasPortfolioAssetDebt: Boolean!
"True if the account's cash balances have debt, may be temporarily inconsistent after a SettleCashEvent"
hasCashDebt: Boolean!
"Currency id of an asset bitmap, if set"
assetBitmapCurrency: Currency
"Account's balances of both cash and nTokens"
balances: [Balance!]!
"Account's portfolio assets"
portfolio: [Asset!]!
"A link to the nToken object if this is an nToken"
nToken: nToken
tradeHistory: [Trade!] @derivedFrom(field: "account")
balanceChanges: [BalanceChange!] @derivedFrom(field: "account")
assetChanges: [AssetChange!] @derivedFrom(field: "account")
nTokenChanges: [nTokenChange!] @derivedFrom(field: "account")
leveragedVaults: [LeveragedVaultAccount!] @derivedFrom(field: "account")
stakedNoteBalance: StakedNoteBalance @derivedFrom(field: "account")
stakedNoteChanges: [StakedNoteChange!] @derivedFrom(field: "account")
}
type Balance @entity {
"Account Address:Currency ID combination"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Reference to currency that this balance represents"
currency: Currency!
"Cash balance denominated in asset cash terms"
assetCashBalance: BigInt!
"nToken balance of this currency"
nTokenBalance: BigInt!
"Last time token incentives were claimed on this balance"
lastClaimTime: Int!
"Last stored integral total supply amount, used to calculate incentives in the original method"
lastClaimIntegralSupply: BigInt
"Accumulator for incentive calculation"
accountIncentiveDebt: BigInt
"True if the account has migrated to the new incentive scheme"
didMigrateIncentives: Boolean
}
type Asset @entity {
"Account:CurrencyId:AssetType:Maturity"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Reference to currency that this balance represents"
currency: Currency!
"Timestamp when fCash matures, if liquidity token this will still refer to fCash maturity date"
maturity: BigInt!
"Date when assets will be settled, quarterly for liquidity tokens and at maturity for fCash"
settlementDate: BigInt!
"Asset type"
assetType: AssetType!
"Notional amount"
notional: BigInt!
}
type Market @entity {
"Currency Id:Settlement Date:Maturity combination"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Currency of this market"
currency: Currency!
"Date that fCash from this market will mature"
maturity: Int!
"Date that this market will settle"
settlementDate: Int!
"Market index"
marketIndex: Int!
"Length of market maturity in seconds"
marketMaturityLengthSeconds: Int!
"Total fCash available in the market"
totalfCash: BigInt!
"Total asset cash available in the market"
totalAssetCash: BigInt!
"Total liquidity tokens available in the market"
totalLiquidity: BigInt!
"Last annualized interest rate the market traded at"
lastImpliedRate: Int!
"Oracle rate for the market, must be averaged in using previousTradeTime"
oracleRate: Int!
"Last time when a trade occurred on the market"
previousTradeTime: Int!
historicalData: [MarketHistoricalData!] @derivedFrom(field: "market")
}
type MarketHistoricalData @entity {
"MarketID:Hourly ID for this particular market"
id: ID!
market: Market!
"Total fCash available in the market"
totalfCash: BigInt!
"Total asset cash available in the market"
totalAssetCash: BigInt!
"Total liquidity tokens available in the market"
totalLiquidity: BigInt!
"Last annualized interest rate the market traded at"
lastImpliedRate: Int!
"Oracle rate for the market, must be averaged in using previousTradeTime"
oracleRate: Int!
"Last time when a trade occurred on the market"
previousTradeTime: Int!
}
type MarketInitialization @entity {
"Currency ID:time reference timestamp"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
transactionOrigin: Bytes!
"Currency of markets"
currency: Currency!
"Markets that were initialized during this event"
markets: [Market!]!
}
enum TradeType {
Lend
Borrow
AddLiquidity
RemoveLiquidity
PurchaseNTokenResidual
SettleCashDebt
Transfer
}
type Trade @entity {
"Currency ID:Account:Transaction hash:logIndex:batchIndex"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
transactionOrigin: Bytes!
account: Account!
currency: Currency!
market: Market
tradeType: TradeType!
maturity: BigInt!
netAssetCash: BigInt!
netUnderlyingCash: BigInt!
netfCash: BigInt!
netLiquidityTokens: BigInt
transferOperator: Bytes
}
type BalanceChange @entity {
"Currency ID:Account:Transaction hash:logIndex"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
transactionOrigin: Bytes!
account: Account!
currency: Currency!
assetCashBalanceBefore: BigInt!
assetCashBalanceAfter: BigInt!
assetCashValueUnderlyingBefore: BigInt!
assetCashValueUnderlyingAfter: BigInt!
nTokenBalanceBefore: BigInt!
nTokenBalanceAfter: BigInt!
nTokenValueAssetBefore: BigInt!
nTokenValueAssetAfter: BigInt!
nTokenValueUnderlyingBefore: BigInt!
nTokenValueUnderlyingAfter: BigInt!
lastClaimTimeBefore: Int!
lastClaimTimeAfter: Int!
lastClaimIntegralSupplyBefore: BigInt
lastClaimIntegralSupplyAfter: BigInt
accountIncentiveDebtBefore: BigInt
accountIncentiveDebtAfter: BigInt
}
type AssetChange @entity {
"Account:CurrencyId:AssetType:Maturity:Transaction hash"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
transactionOrigin: Bytes!
account: Account!
currency: Currency!
maturity: BigInt!
settlementDate: BigInt!
assetType: AssetType!
notionalBefore: BigInt!
notionalAfter: BigInt!
}
type nTokenChange @entity {
"nTokenAddress:Transaction hash"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
transactionOrigin: Bytes!
nToken: nToken!
"Account that mints or redeems nTokens, set to null on initialize markets"
account: Account
assetChanges: [AssetChange!]
balanceChange: BalanceChange
totalSupplyBefore: BigInt!
totalSupplyAfter: BigInt!
"Deprecated integral total supply before and after"
integralTotalSupplyBefore: BigInt
integralTotalSupplyAfter: BigInt
"Last supply change time before and after, equivalent to last accumulated time"
lastSupplyChangeTimeBefore: BigInt!
lastSupplyChangeTimeAfter: BigInt!
"Represents the accumulated NOTE incentives on the nToken"
accumulatedNOTEPerNTokenBefore: BigInt
accumulatedNOTEPerNTokenAfter: BigInt
}
type EthExchangeRateHistoricalData @entity {
id: ID!
timestamp: Int!
value: BigInt!
currency: Currency!
}
type AssetExchangeRateHistoricalData @entity {
id: ID!
timestamp: Int!
value: BigInt!
currency: Currency!
}
type NTokenPresentValueHistoricalData @entity {
id: ID!
timestamp: Int!
pvAsset: BigInt!
pvUnderlying: BigInt!
currency: Currency!
}
type CurrencyTvl @entity {
id: ID!
currency: Currency!
underlyingValue: BigInt!
usdValue: BigInt!
}
type COMPBalance @entity {
id: ID!
timestamp: Int!
value: BigInt!
usdValue: BigInt!
}
type StakedNoteTvl @entity {
id: ID!
timestamp: Int!
"Total sNOTE in the pool"
sNOTETotalSupply: BigInt!
"Total NOTE in the pool"
poolNOTEBalance: BigInt!
"Total ETH in the pool"
poolETHBalance: BigInt!
"Total BPT balance in the pool"
poolBPTBalance: BigInt!
"NOTE/ETH spot price of the pool"
spotPrice: BigInt!
"Total pool value in each relevant denomination using historical spot prices"
totalPoolValueInNOTE: BigInt!
totalPoolValueInETH: BigInt!
}
type TvlHistoricalData @entity {
id: ID!
timestamp: Int!
usdTotal: BigInt
perCurrencyTvl: [CurrencyTvl!]
compBalance: COMPBalance
sNOTETvl: StakedNoteTvl
}
type AssetTransfer @entity {
"from:to:assetId:Transaction hash"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
transactionOrigin: Bytes!
fromAssetChange: AssetChange!
toAssetChange: AssetChange!
}
enum LiquidationType {
LocalCurrency
LocalFcash
CollateralCurrency
CrossCurrencyFcash
}
type Liquidation @entity {
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
transactionOrigin: Bytes!
type: LiquidationType!
account: Account!
liquidator: Account!
localCurrency: Currency!
netLocalFromLiquidator: BigInt!
collateralOrFcashCurrency: Currency
netCollateralTransfer: BigInt
netNTokenTransfer: BigInt
fCashMaturities: [BigInt!]
fCashNotionalTransfer: [BigInt!]
}
# Data accumulated and condensed into day stats for lending and borrowing
type DailyLendBorrowVolume @entity {
id: ID!
date: Int!
currency: Currency!
market: Market!
trades: [Trade!]!
marketIndex: Int!
tradeType: TradeType!
totalVolumeUnderlyingCash: BigInt!
totalVolumeNetAssetCash: BigInt!
totalVolumeNetfCash: BigInt!
txCount: BigInt!
}
# One off migration for incentive calculation, snapshot values stored here
type IncentiveMigration @entity {
"Currency ID of the migrated entity"
id: ID!
currency: Currency!
"Snapshot of the incentive emission rate at migration"
migrationEmissionRate: BigInt!
"Snapshot of the integral total supply at migration"
finalIntegralTotalSupply: BigInt!
"Time when the currency was migrated"
migrationTime: BigInt!
}
type NoteBalance @entity {
"Account address"
id: ID!
"Provides a link to a NOTE holder's Notional accounts (if they exist)"
account: Account!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
delegate: Delegate
noteBalance: BigInt!
noteBalanceChanges: [NoteBalanceChange!]! @derivedFrom(field: "noteBalance")
}
type NoteBalanceChange @entity {
"Account address:TransactionHash:LogIndex"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
account: Account!
noteBalance: NoteBalance!
noteBalanceBefore: BigInt!
noteBalanceAfter: BigInt!
sender: Bytes!
receiver: Bytes!
}
type StakedNoteBalance @entity {
"Account address"
id: ID!
"Provides a link to a staker's Notional accounts (if they exist)"
account: Account!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
delegate: Delegate
"Current sNOTE balance of the account"
sNOTEBalance: BigInt!
"Total amount of ETH/WETH used to join the pool"
ethAmountJoined: BigInt!
"Total amount of NOTE used to join the pool"
noteAmountJoined: BigInt!
"Total amount of ethRedeemed from the pool"
ethAmountRedeemed: BigInt!
"Total amount of noteRedeemed from the pool"
noteAmountRedeemed: BigInt!
currentCoolDown: StakedNoteCoolDown
coolDowns: [StakedNoteCoolDown!] @derivedFrom(field: "stakedNoteBalance")
stakedNoteChanges: [StakedNoteChange!]! @derivedFrom(field: "stakedNoteBalance")
}
type StakedNoteCoolDown @entity {
id: ID!
startedBlockHash: Bytes!
startedBlockNumber: Int!
startedTimestamp: Int!
startedTransactionHash: Bytes!
endedBlockHash: Bytes
endedBlockNumber: Int
endedTimestamp: Int
endedTransactionHash: Bytes
stakedNoteBalance: StakedNoteBalance!
userEndedCoolDown: Boolean
redeemWindowBegin: Int!
redeemWindowEnd: Int!
}
enum sNOTEChangeType {
Transfer,
Stake,
Unstake
}
type StakedNoteChange @entity {
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
account: Account!
stakedNoteBalance: StakedNoteBalance!
sNOTEChangeType: sNOTEChangeType!
sNOTEAmountBefore: BigInt!
sNOTEAmountAfter: BigInt!
ethAmountChange: BigInt!
noteAmountChange: BigInt!
bptAmountChange: BigInt!
sender: Bytes
receiver: Bytes
}
type StakedNotePool @entity {
"Staked NOTE address"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
totalBPTTokens: BigInt!
totalSupply: BigInt!
bptPerSNOTE: BigInt!
}
type StakedNoteInvestment @entity {
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
"The treasury manager who executed the investment"
manager: TreasuryManager!
bptPerSNOTEBefore: BigInt!
bptPerSNOTEAfter: BigInt!
totalETHInvested: BigInt!
totalNOTEInvested: BigInt!
totalSNOTESupply: BigInt!
}
type Treasury @entity {
"ID hardcoded to zero"
id: ID!
contractAddress: Bytes!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
activeManager: TreasuryManager
investmentCoolDownInSeconds: BigInt
NOTEPurchaseLimit: BigInt
tradingLimits: [TreasuryManagerTradingLimit!] @derivedFrom(field: "treasury")
"A list of all treasury managers"
managers: [TreasuryManager!] @derivedFrom(field: "treasury")
}
type TreasuryManager @entity {
"ID is the manager's ethereum address"
id: ID!
startedBlockHash: Bytes!
startedBlockNumber: Int!
startedTimestamp: Int!
startedTransactionHash: Bytes!
endedBlockHash: Bytes!
endedBlockNumber: Int!
endedTimestamp: Int!
endedTransactionHash: Bytes!
"Set to true for the manager who is currently active"
isActiveManager: Boolean!
treasury: Treasury!
sNOTEInvestments: [StakedNoteInvestment!] @derivedFrom(field: "manager")
tokenTrades: [TreasuryTokenTrade!] @derivedFrom(field: "manager")
}
type TreasuryManagerTradingLimit @entity {
"ID is the token address"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
treasury: Treasury!
tokenAddress: Bytes!
symbol: String!
name: String!
oracle: Bytes
slippageLimit: BigInt
}
type TreasuryTokenTrade @entity {
"ID is the 0x order hash"
id: ID!
blockHash: Bytes!
blockNumber: Int!
timestamp: Int!
transactionHash: Bytes!
manager: TreasuryManager!
"Taker that filled the order"
takerAddress: Bytes!
"Token that the treasury sold"
makerAsset: TreasuryManagerTradingLimit!
"Token that the taker sent back to the treasury"
takerAsset: Bytes!
takerAssetSymbol: String
takerAssetName: String
takerAssetDecimals: Int
makerAssetFilledAmount: BigInt!
takerAssetFilledAmount: BigInt!
oraclePrice: BigInt
oracleDecimals: Int
}
type LeveragedVaultDirectory @entity {
"ID is always set to 0"
id: ID!
listedLeveragedVaults: [LeveragedVault!]!
}
type LeveragedVault @entity {
"ID is the address of the vault"
id: ID!
lastUpdateBlockHash: Bytes!
lastUpdateBlockNumber: Int!
lastUpdateTimestamp: Int!
lastUpdateTransactionHash: Bytes!
"Address of the strategy vault"
vaultAddress: Bytes!
"Strategy identifier for the vault"
strategy: Bytes!
"Name of the strategy vault"
name: String!
"Primary currency the vault borrows in"
primaryBorrowCurrency: Currency!
"Minimum amount of primary currency that must be borrowed"
minAccountBorrowSize: BigInt!
"Minimum collateral ratio before liquidation"
minCollateralRatioBasisPoints: Int!
"Maximum collateral ratio that liquidation can reach"
maxDeleverageCollateralRatioBasisPoints: Int!
"Fee assessed on primary borrow paid to the nToken and protocol"
feeRateBasisPoints: Int!
"Share of fee paid to protocol reserve"
reserveFeeSharePercent: Int!
"Discount rate given to liquidators"
liquidationRatePercent: Int!
"Maximum market index for borrowing terms"
maxBorrowMarketIndex: Int!
"Secondary borrow currencies (if any)"
secondaryBorrowCurrencies: [Currency!]
"Max required collateral ratio for vault accounts"
maxRequiredAccountCollateralRatioBasisPoints: Int