-
Notifications
You must be signed in to change notification settings - Fork 237
/
schema-derivatives-perpfutures.graphql
1977 lines (1356 loc) · 64.7 KB
/
schema-derivatives-perpfutures.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
# Subgraph Schema: Derivatives Perpetual Futures
# Version: 1.3.4
# See https://github.com/messari/subgraphs/blob/master/docs/SCHEMA.md for details
enum Network {
ARBITRUM_ONE
ARWEAVE_MAINNET
AURORA
AVALANCHE
BOBA
BSC # aka BNB Chain
CELO
COSMOS
CRONOS
MAINNET # Ethereum Mainnet
FANTOM
FUSE
HARMONY
JUNO
MOONBEAM
MOONRIVER
NEAR_MAINNET
OPTIMISM
OSMOSIS
MATIC # aka Polygon
XDAI # aka Gnosis Chain
}
enum ProtocolType {
EXCHANGE
LENDING
YIELD
BRIDGE
OPTION
PERPETUAL
GENERIC
# Will add more
}
type Token @entity @regularPolling {
" Smart contract address of the token "
id: Bytes!
" Name of the token, mirrored from the smart contract "
name: String!
" Symbol of the token, mirrored from the smart contract "
symbol: String!
" The number of decimal places this token uses, default to 18 "
decimals: Int!
" Optional field to track the price of a token, mostly for caching purposes "
lastPriceUSD: BigDecimal
" Optional field to track the block number of the last token price "
lastPriceBlockNumber: BigInt
}
enum RewardTokenType {
" For reward tokens awarded to LPs/lenders "
DEPOSIT
" For reward tokens awarded to borrowers "
BORROW
" For reward tokens awarded to stakers of native token (e.g. GMX stakers) "
STAKE
}
type RewardToken @entity(immutable: true) @regularPolling {
" Bytes.fromI32(0|1).concat(rewardTokenAddress), where 0 is for deposit and 1 is for borrow "
id: Bytes!
" Reference to the actual token "
token: Token!
" The type of the reward token "
type: RewardTokenType!
}
# Note that trading fee is the premium paid *by* the users, whereas LP fee, stake fee and
# protocol fee are fees paid *to* the corresponding parties.
# Most of the time, trading fee = liquidity provider fee + protocol fee+stake fee,
# but not always. Thus we explicitly specify all different fee types.
enum LiquidityPoolFeeType {
" Total fixed fee paid by the user per trade, as a percentage of the traded amount. e.g. 0.3% for Uniswap v2, 0.3% for Sushiswap, 0.04% for Curve v1. "
FIXED_TRADING_FEE
" Some protocols use tiered fees instead of fixed fee (e.g. DYDX). Set `feePercentage` as 0 but handle the tiered fees in the mapping code. "
TIERED_TRADING_FEE
" Some protocols use dynamic fees instead of fixed fee (e.g. Balancer v2). Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. "
DYNAMIC_TRADING_FEE
" Fixed fee that's paid to the LP, as a percentage of the traded amount. e.g. 10% of fees to GMX LP providers (GLP holders). "
FIXED_LP_FEE
" Some protocols use dynamic LP fees . Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. "
DYNAMIC_LP_FEE
" Fixed fee that's paid to the protocol, as a percentage of the traded amount. e.g. 10% of GMX fees to protocol. "
FIXED_PROTOCOL_FEE
" Some protocols use dynamic protocol fees. Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. "
DYNAMIC_PROTOCOL_FEE
" Fixed fee that's paid to the stakers, as a percentage of the traded amount. e.g. 30% of all fees on GMX to stakers. "
FIXED_STAKE_FEE
" Some protocols use dynamic stakers fees (e.g., GMX). Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. "
DYNAMIC_STAKE_FEE
" One-time fee charged by the protocol during deposit, in percentages of the deposit token (e.g. dynamic fee collected for LP providers in GMX)"
DEPOSIT_FEE
" One-time fee charged by the protocol (e.g. GMX charges a fee from certain pools with withdrawing) during withdrawal, in percentages of the withdrawal token "
WITHDRAWAL_FEE
}
type LiquidityPoolFee @entity @regularPolling {
" { Fee type }-{ Pool address } "
id: Bytes!
" Fee as a percentage of the trade (swap) amount. Does not always apply "
feePercentage: BigDecimal
" Type of fee this pool uses "
feeType: LiquidityPoolFeeType!
}
#############################
##### Protocol Metadata #####
#############################
interface Protocol {
" Smart contract address of the protocol's main contract (Factory, Registry, etc) "
id: Bytes!
" 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!
" The blockchain network this subgraph is indexing on "
network: Network!
" The type of protocol (e.g. DEX, Lending, Yield, etc) "
type: ProtocolType!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of the entire protocol "
totalValueLockedUSD: BigDecimal!
" Revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 70% of fees on GMX). Depositors on Lending Protocols. NFT sellers on OpenSea. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Gross revenue for the protocol (revenue claimed by protocol). Examples: 15% on GMX goes to protocol . OpenSea 10% sell fee. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" Gross revenue for the stakers (this is defined as recieving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) "
cumulativeStakeSideRevenueUSD: BigDecimal!
" All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. "
cumulativeTotalRevenueUSD: BigDecimal!
" All premium paid to enter a position. "
cumulativeEntryPremiumUSD: BigDecimal!
" All premium paid to exit a position. "
cumulativeExitPremiumUSD: BigDecimal!
" All premium paid. "
cumulativeTotalPremiumUSD: BigDecimal!
" All premium paid to deposit in liquidity pools. "
cumulativeDepositPremiumUSD: BigDecimal!
" All premium paid to withdraw from liquidity pools. "
cumulativeWithdrawPremiumUSD: BigDecimal!
" All premium paid to enter and exit liquidity pool. "
cumulativeTotalLiquidityPremiumUSD: BigDecimal!
" Number of cumulative unique users "
cumulativeUniqueUsers: Int!
" Number of cumulative borrowers "
cumulativeUniqueBorrowers: Int!
" Number of cumulative liquidators (accounts that performed liquidation) "
cumulativeUniqueLiquidators: Int!
" Number of cumulative liquidatees (accounts that got liquidated) "
cumulativeUniqueLiquidatees: Int!
" Notional value of all open long positions "
longOpenInterestUSD: BigDecimal!
" Notional value of all open short positions "
shortOpenInterestUSD: BigDecimal!
" Notional value of all open positions "
totalOpenInterestUSD: BigDecimal!
" Total number of long positions (not cumulative) "
longPositionCount: Int!
" Total number of short positions (not cumulative) "
shortPositionCount: Int!
" Total number of open positions (not cumulative) "
openPositionCount: Int!
" Total number of closed positions "
closedPositionCount: Int!
" Total number of positions (open and closed) "
cumulativePositionCount: Int!
" Total number of transactions "
transactionCount: Int!
" Total number of deposits "
depositCount: Int!
" Total number of withdrawals "
withdrawCount: Int!
" Total number of borrows "
borrowCount: Int!
" Total number of pools "
totalPoolCount: Int!
##### Snapshots #####
" Daily usage metrics for this protocol "
dailyUsageMetrics: [UsageMetricsDailySnapshot!]!
@derivedFrom(field: "protocol")
" Hourly usage metrics for this protocol "
hourlyUsageMetrics: [UsageMetricsHourlySnapshot!]!
@derivedFrom(field: "protocol")
" Daily financial metrics for this protocol "
financialMetrics: [FinancialsDailySnapshot!]! @derivedFrom(field: "protocol")
}
type DerivPerpProtocol implements Protocol @entity @regularPolling {
" Smart contract address of the protocol's main contract (Factory, Registry, etc) "
id: Bytes!
" 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!
" The blockchain network this subgraph is indexing on "
network: Network!
" The type of protocol (e.g. DEX, Lending, Yield, etc) "
type: ProtocolType!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of the entire protocol "
totalValueLockedUSD: BigDecimal!
" All historical Notional volume in USD "
cumulativeVolumeUSD: BigDecimal!
" Inflow historical trade notional volume occurred in this protocol, in USD, based on value of underlying assets coming into protocol from trade, at the time of position opened. "
cumulativeInflowVolumeUSD: BigDecimal!
" Inflow historical trade notional volume occurred in this protocol, in USD, based on value of underlying assets coming into protocol from trade, at the time of position closed. "
cumulativeClosedInflowVolumeUSD: BigDecimal!
" Outflow historical trade notional volume occurred in this protocol, in USD, based on value of underlying assets coming out of protocol from trade. "
cumulativeOutflowVolumeUSD: 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. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" Gross revenue for the stakers (this is defined as receiving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) "
cumulativeStakeSideRevenueUSD: BigDecimal!
" All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. "
cumulativeTotalRevenueUSD: BigDecimal!
" All premium paid to enter a position. "
cumulativeEntryPremiumUSD: BigDecimal!
" All premium paid to exit a position. "
cumulativeExitPremiumUSD: BigDecimal!
" All premium paid. "
cumulativeTotalPremiumUSD: BigDecimal!
" All premium paid to deposit in the protocol. "
cumulativeDepositPremiumUSD: BigDecimal!
" All premium paid to withdraw from the protocol. "
cumulativeWithdrawPremiumUSD: BigDecimal!
" All premium paid to enter and exit the protocol. "
cumulativeTotalLiquidityPremiumUSD: BigDecimal!
" Number of cumulative unique users "
cumulativeUniqueUsers: Int!
" Number of cumulative depositors "
cumulativeUniqueDepositors: Int!
" Number of cumulative borrowers "
cumulativeUniqueBorrowers: Int!
" Number of cumulative liquidators (accounts that performed liquidation) "
cumulativeUniqueLiquidators: Int!
" Number of cumulative liquidatees (accounts that got liquidated) "
cumulativeUniqueLiquidatees: Int!
" Notional value of all open long positions "
longOpenInterestUSD: BigDecimal!
" Notional value of all open short positions "
shortOpenInterestUSD: BigDecimal!
" Notional value of all open positions "
totalOpenInterestUSD: BigDecimal!
" Total number of long positions (not cumulative) "
longPositionCount: Int!
" Total number of short positions (not cumulative) "
shortPositionCount: Int!
" Total number of open positions (not cumulative) "
openPositionCount: Int!
" Total number of closed positions "
closedPositionCount: Int!
" Total number of positions (open and closed) "
cumulativePositionCount: Int!
" Total number of transactions "
transactionCount: Int!
" Total number of deposits "
depositCount: Int!
" Total number of withdrawals "
withdrawCount: Int!
" Total number of borrows "
borrowCount: Int!
" Total number of swaps "
swapCount: Int!
" Total number of collateral In from traders "
collateralInCount: Int!
" Total number of collateral Out from traders "
collateralOutCount: Int!
" Total number of pools "
totalPoolCount: Int!
##### Snapshots #####
" Daily usage metrics for this protocol "
dailyUsageMetrics: [UsageMetricsDailySnapshot!]!
@derivedFrom(field: "protocol")
" Hourly usage metrics for this protocol "
hourlyUsageMetrics: [UsageMetricsHourlySnapshot!]!
@derivedFrom(field: "protocol")
" Daily financial metrics for this protocol "
financialMetrics: [FinancialsDailySnapshot!]! @derivedFrom(field: "protocol")
##### Pools #####
" All pools that belong to this protocol "
pools: [LiquidityPool!]! @derivedFrom(field: "protocol")
" Day ID of the most recent daily snapshot "
_lastSnapshotDayID: BigInt
" Hour ID of the most recent hourly snapshot "
_lastSnapshotHourID: BigInt
" Timestamp of the last time this entity was updated "
_lastUpdateTimestamp: BigInt
}
###############################
##### Protocol Timeseries #####
###############################
type UsageMetricsDailySnapshot @entity(immutable: true) @dailySnapshot {
" ID is # of days since Unix epoch time "
id: Bytes!
" Number of days since Unix epoch time "
days: Int!
" Protocol this snapshot is associated with "
protocol: DerivPerpProtocol!
" Number of unique daily active users "
dailyActiveUsers: Int!
" Number of cumulative unique users "
cumulativeUniqueUsers: Int!
" Daily number of long positions "
dailyLongPositionCount: Int!
" Total number of long positions (not cumulative) "
longPositionCount: Int!
" Daily number of short positions "
dailyShortPositionCount: Int!
" Total number of short positions (not cumulative) "
shortPositionCount: Int!
" Daily number of open positions "
dailyOpenPositionCount: Int!
" Total number of open positions (not cumulative) "
openPositionCount: Int!
" Daily number of closed positions "
dailyClosedPositionCount: Int!
" Total number of closed positions "
closedPositionCount: Int!
" Daily number of positions (open and closed) "
dailyCumulativePositionCount: Int!
" Total number of positions (open and closed) "
cumulativePositionCount: Int!
" Daily number of transactions. Transactions include all entities that implement the Event interface. "
dailyTransactionCount: Int!
" Daily number of deposits (add liquidity) "
dailyDepositCount: Int!
" Daily number of withdrawals (remove liquidity) "
dailyWithdrawCount: Int!
" Daily number of borrows for leverage "
dailyBorrowCount: Int!
" Daily number of trades (swaps) "
dailySwapCount: Int!
" Number of unique daily depositors "
dailyActiveDepositors: Int!
" Number of cumulative depositors "
cumulativeUniqueDepositors: Int!
" Number of unique daily borrowers "
dailyActiveBorrowers: Int!
" Number of cumulative borrowers "
cumulativeUniqueBorrowers: Int!
" Number of unique daily liquidators (accounts that performed liquidation) "
dailyActiveLiquidators: Int!
" Number of cumulative liquidators (accounts that performed liquidation) "
cumulativeUniqueLiquidators: Int!
" Number of unique daily liquidatees (accounts that got liquidated) "
dailyActiveLiquidatees: Int!
" Number of cumulative liquidatees (accounts that got liquidated) "
cumulativeUniqueLiquidatees: Int!
" Daily number of collateral In from traders "
dailyCollateralIn: Int!
" Cumulative number of collateral In from traders "
cumulativeCollateralIn: Int!
" Daily number of collateral Out from traders "
dailyCollateralOut: Int!
" Cumulative number of collateral Out from traders "
cumulativeCollateralOut: Int!
" Total number of pools "
totalPoolCount: Int!
" Timestamp of this snapshot "
timestamp: BigInt!
}
type UsageMetricsHourlySnapshot @entity(immutable: true) @hourlySnapshot {
" { # of hours since Unix epoch time } "
id: Bytes!
" Number of hours since Unix epoch time "
hours: Int!
" Protocol this snapshot is associated with "
protocol: DerivPerpProtocol!
" Number of unique hourly active users "
hourlyActiveUsers: Int!
" Number of cumulative unique users "
cumulativeUniqueUsers: Int!
" Total number of transactions occurred in an hour. Transactions include all entities that implement the Event interface. "
hourlyTransactionCount: Int!
" Total number of deposits (add liquidity) in an hour "
hourlyDepositCount: Int!
" Total number of withdrawals (remove liquidity) in an hour "
hourlyWithdrawCount: Int!
" Total number of borrows (for additional leverage) in an hour "
hourlyBorrowCount: Int!
" Total number of trades (swaps) in an hour "
hourlySwapCount: Int!
" Timestamp of this snapshot "
timestamp: BigInt!
}
type FinancialsDailySnapshot @entity(immutable: true) @dailySnapshot {
" ID is # of days since Unix epoch time "
id: Bytes!
" Number of days since Unix epoch time "
days: Int!
" Protocol this snapshot is associated with "
protocol: DerivPerpProtocol!
" Current TVL (Total Value Locked) of the entire protocol "
totalValueLockedUSD: BigDecimal!
" Daily trade Notional volume, in USD "
dailyVolumeUSD: BigDecimal!
" All historical trade Notional volume in USD "
cumulativeVolumeUSD: BigDecimal!
" Daily Inflow trade Notional volume, in USD, based on value of underlying assets coming into protocol at the time of position open "
dailyInflowVolumeUSD: BigDecimal!
" Inflow historical trade Notional volume in USD, based on value of underlying assets coming into protocol from trade at the time of position open "
cumulativeInflowVolumeUSD: BigDecimal!
" Daily Inflow trade Notional volume, in USD, based on value of underlying assets coming into protocol at the time of position Closed "
dailyClosedInflowVolumeUSD: BigDecimal!
" Inflow historical trade Notional volume in USD, based on value of underlying assets coming into protocol from trade at the time of position closed "
cumulativeClosedInflowVolumeUSD: BigDecimal!
" Daily Outflow trade Notional volume, in USD, based on value of underlying assets coming out of protocol from trade "
dailyOutflowVolumeUSD: BigDecimal!
" Outflow historical trade Notional volume in USD, based on value of underlying assets coming out of protocol from trade "
cumulativeOutflowVolumeUSD: BigDecimal!
" Daily Notional value of all open long positions "
dailyLongOpenInterestUSD: BigDecimal!
" Daily Notional value of all open short positions "
dailyShortOpenInterestUSD: BigDecimal!
" Daily Notional value of all open positions "
dailyTotalOpenInterestUSD: BigDecimal!
" Daily 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. "
dailySupplySideRevenueUSD: 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. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Daily revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. "
dailyProtocolSideRevenueUSD: BigDecimal!
" Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" Daily revenue for the stakers (this is defined as recieving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) "
dailyStakeSideRevenueUSD: BigDecimal!
" Gross revenue for the stakers (this is defined as recieving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) "
cumulativeStakeSideRevenueUSD: BigDecimal!
" Daily revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. "
dailyTotalRevenueUSD: BigDecimal!
" All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. "
cumulativeTotalRevenueUSD: BigDecimal!
" Daily premium paid to enter a position. "
dailyEntryPremiumUSD: BigDecimal!
" All premium paid to enter a position. "
cumulativeEntryPremiumUSD: BigDecimal!
" Daily premium paid to exit a position. "
dailyExitPremiumUSD: BigDecimal!
" All premium paid to exit a position. "
cumulativeExitPremiumUSD: BigDecimal!
" Daily premium paid. "
dailyTotalPremiumUSD: BigDecimal!
" All premium paid. "
cumulativeTotalPremiumUSD: BigDecimal!
" Daily premium paid to deposit in liquidity pools. "
dailyDepositPremiumUSD: BigDecimal!
" All premium paid to deposit in liquidity pools. "
cumulativeDepositPremiumUSD: BigDecimal!
" Daily premium paid to withdraw from liquidity pools. "
dailyWithdrawPremiumUSD: BigDecimal!
" All premium paid to withdraw from liquidity pools. "
cumulativeWithdrawPremiumUSD: BigDecimal!
" Daily premium paid to enter and exit liquidity pool. "
dailyTotalLiquidityPremiumUSD: BigDecimal!
" All premium paid to enter and exit liquidity pool. "
cumulativeTotalLiquidityPremiumUSD: BigDecimal!
" Timestamp of this snapshot "
timestamp: BigInt!
}
###############################
##### Pool-Level Metadata #####
###############################
type LiquidityPool @entity @regularPolling {
" Smart contract address of the pool "
id: Bytes!
" The protocol this pool belongs to "
protocol: DerivPerpProtocol!
" Name of liquidity pool (e.g. Curve.fi DAI/USDC/USDT) "
name: String
" Symbol of liquidity pool (e.g. 3CRV) "
symbol: String
" Tokens that need to be deposited to take a position in protocol. e.g. WETH and USDC to deposit into the WETH-USDC pool. Array to account for multi-asset pools like Curve and Balancer "
inputTokens: [Token!]!
" Token that is minted to track ownership of position in protocol "
outputToken: Token
" Additional tokens that are given as reward for position in a protocol, usually in liquidity mining programs. e.g. SUSHI in the Onsen program, MATIC for Aave Polygon, usually in liquidity mining programs. e.g. SUSHI in the Onsen program, MATIC for Aave Polygon "
rewardTokens: [RewardToken!]
" Fees per trade incurred to the user. Should include all fees that apply to a pool (e.g. Curve has a trading fee AND an admin fee, which is a portion of the trading fee. Uniswap only has a trading fee and no protocol fee. ) "
fees: [LiquidityPoolFee!]!
" Name of oracle source (e.g. chainlink, uniswap, pyth) "
oracle: String
" Creation timestamp "
createdTimestamp: BigInt!
" Creation block number "
createdBlockNumber: BigInt!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of this pool in USD "
totalValueLockedUSD: BigDecimal!
" All funding rates for this liquidity pool. (Should be in APR format and the same order as inputTokens) "
fundingrate: [BigDecimal!]!
" All revenue generated by the liquidity pool, accrued to the supply side. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" All revenue generated by the liquidity pool, accrued to the protocol. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" All revenue generated by the liquidity pool, accrued to the stakers of governance token. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) "
cumulativeStakeSideRevenueUSD: BigDecimal!
" All revenue generated by the liquidity pool. "
cumulativeTotalRevenueUSD: BigDecimal!
" All premium paid to enter a position. "
cumulativeEntryPremiumUSD: BigDecimal!
" All premium paid to exit a position. "
cumulativeExitPremiumUSD: BigDecimal!
" All premium paid. "
cumulativeTotalPremiumUSD: BigDecimal!
" All premium paid to deposit in liquidity pools. "
cumulativeDepositPremiumUSD: BigDecimal!
" All premium paid to withdraw from liquidity pools. "
cumulativeWithdrawPremiumUSD: BigDecimal!
" All premium paid to enter and exit liquidity pool. "
cumulativeTotalLiquidityPremiumUSD: BigDecimal!
" Number of cumulative unique users in this pool "
cumulativeUniqueUsers: Int!
" Number of cumulative depositors in this pool "
cumulativeUniqueDepositors: Int!
" Number of cumulative borrowers "
cumulativeUniqueBorrowers: Int!
" Number of cumulative liquidators (accounts that performed liquidation) "
cumulativeUniqueLiquidators: Int!
" Number of cumulative liquidatees (accounts that got liquidated) "
cumulativeUniqueLiquidatees: Int!
" Notional value of all open long positions "
longOpenInterestUSD: BigDecimal!
" Notional value of all open short positions "
shortOpenInterestUSD: BigDecimal!
" Notional value of all open positions "
totalOpenInterestUSD: BigDecimal!
" Total number of long positions (not cumulative) "
longPositionCount: Int!
" Total number of short positions (not cumulative) "
shortPositionCount: Int!
" Total number of open positions (not cumulative) "
openPositionCount: Int!
" Total number of closed positions "
closedPositionCount: Int!
" Total number of positions (open and closed) "
cumulativePositionCount: Int!
" All historical trade notional volume occurred in this pool, in USD "
cumulativeVolumeUSD: BigDecimal!
" Cumulative volume of pool by token amount "
cumulativeVolumeByTokenAmount: [BigInt!]!
" Cumulative volume of pool in USD "
cumulativeVolumeByTokenUSD: [BigDecimal!]!
" Inflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming into protocol from trade, at the time of position opened. "
cumulativeInflowVolumeUSD: BigDecimal!
" Cumulative inflow volume of pool by token amount "
cumulativeInflowVolumeByTokenAmount: [BigInt!]!
" Cumulative inflow volume of pool in USD "
cumulativeInflowVolumeByTokenUSD: [BigDecimal!]!
" Inflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming into protocol from trade, at the time of position closed. "
cumulativeClosedInflowVolumeUSD: BigDecimal!
" Cumulative closed inflow volume of pool by token amount "
cumulativeClosedInflowVolumeByTokenAmount: [BigInt!]!
" Cumulative closed inflow volume of pool in USD "
cumulativeClosedInflowVolumeByTokenUSD: [BigDecimal!]!
" Outflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming outof protocol from trade. "
cumulativeOutflowVolumeUSD: BigDecimal!
" Cumulative outflow volume of pool by token amount "
cumulativeOutflowVolumeByTokenAmount: [BigInt!]!
" Cumulative outflow volume of pool in USD "
cumulativeOutflowVolumeByTokenUSD: [BigDecimal!]!
" Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. "
inputTokenBalances: [BigInt!]!
" Weights of input tokens in the liquidity pool in percentage values. For example, 50/50 for Uniswap pools, 48.2/51.8 for a Curve pool, 10/10/80 for a Balancer pool "
inputTokenWeights: [BigDecimal!]!
" Total supply of output token. Note that certain DEXes don't have an output token (e.g. Bancor) "
outputTokenSupply: BigInt
" Price per share of output token in USD "
outputTokenPriceUSD: BigDecimal
" Total supply of output tokens that are staked (usually in the MasterChef contract). Used to calculate reward APY. "
stakedOutputTokenAmount: BigInt
" Per-block reward token emission as of the current block normalized to a day, in token's native amount. This should be ideally calculated as the theoretical rate instead of the realized amount. "
rewardTokenEmissionsAmount: [BigInt!]
" Per-block reward token emission as of the current block normalized to a day, in USD value. This should be ideally calculated as the theoretical rate instead of the realized amount. "
rewardTokenEmissionsUSD: [BigDecimal!]
##### Snapshots #####
" Liquidity pool daily snapshots "
dailySnapshots: [LiquidityPoolDailySnapshot!]! @derivedFrom(field: "pool")
" Liquidity pool hourly snapshots "
hourlySnapshots: [LiquidityPoolHourlySnapshot!]! @derivedFrom(field: "pool")
##### Events #####
" All deposit (add liquidity) events occurred in this pool "
deposits: [Deposit!]! @derivedFrom(field: "pool")
" All withdraw (remove liquidity) events occurred in this pool "
withdraws: [Withdraw!]! @derivedFrom(field: "pool")
" All trade (swap) events occurred in this pool "
swaps: [Swap!]! @derivedFrom(field: "pool")
" Day ID of the most recent daily snapshot "
_lastSnapshotDayID: BigInt
" Hour ID of the most recent hourly snapshot "
_lastSnapshotHourID: BigInt
" Timestamp of the last time this entity was updated "
_lastUpdateTimestamp: BigInt
}
#################################
##### Pool-Level Timeseries #####
#################################
type LiquidityPoolDailySnapshot @entity(immutable: true) @dailySnapshot {
" { Smart contract address of the pool }-{ # of days since Unix epoch time } "
id: Bytes!
" Number of days since Unix epoch time "
days: Int!
" The protocol this snapshot belongs to "
protocol: DerivPerpProtocol!
" The pool this snapshot belongs to "
pool: LiquidityPool!
" Timestamp of this snapshot "
timestamp: BigInt!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of this pool "
totalValueLockedUSD: BigDecimal!
" All revenue generated by the liquidity pool, accrued to the supply side. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Daily revenue generated by the liquidity pool, accrued to the supply side. "
dailySupplySideRevenueUSD: BigDecimal!
" All revenue generated by the liquidity pool, accrued to the protocol. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" Daily revenue generated by the liquidity pool, accrued to the protocol. "
dailyProtocolSideRevenueUSD: BigDecimal!
" All revenue generated by the liquidity pool, accrued to the stakers of the governance token. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) "
cumulativeStakeSideRevenueUSD: BigDecimal!
" Daily revenue generated by the liquidity pool, accrued to the stakers of the governance token. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers)"
dailyStakeSideRevenueUSD: BigDecimal!
" Daily revenue generated by the liquidity pool. "
dailyTotalRevenueUSD: BigDecimal!
" All revenue generated by the liquidity pool. "
cumulativeTotalRevenueUSD: BigDecimal!
" Daily funding rate based on rate given by protocol, inform us if this is not provided."
dailyFundingrate: [BigDecimal!]!
" Daily Notional value of all open long positions "
dailyLongOpenInterestUSD: BigDecimal!
" Daily Notional value of all open short positions "
dailyShortOpenInterestUSD: BigDecimal!
" Daily Notional value of all open positions "
dailyTotalOpenInterestUSD: BigDecimal!
" Daily premium paid to enter a position. "
dailyEntryPremiumUSD: BigDecimal!
" All premium paid to enter a position. "
cumulativeEntryPremiumUSD: BigDecimal!
" Daily premium paid to exit a position. "
dailyExitPremiumUSD: BigDecimal!
" All premium paid to exit a position. "
cumulativeExitPremiumUSD: BigDecimal!
" Daily premium paid. "
dailyTotalPremiumUSD: BigDecimal!
" All premium paid. "
cumulativeTotalPremiumUSD: BigDecimal!
" Daily premium paid to deposit in liquidity pools. "
dailyDepositPremiumUSD: BigDecimal!
" All premium paid to deposit in liquidity pools. "
cumulativeDepositPremiumUSD: BigDecimal!
" Daily premium paid to withdraw from liquidity pools. "
dailyWithdrawPremiumUSD: BigDecimal!
" All premium paid to withdraw from liquidity pools. "
cumulativeWithdrawPremiumUSD: BigDecimal!
" Daily premium paid to enter and exit liquidity pool. "
dailyTotalLiquidityPremiumUSD: BigDecimal!
" All premium paid to enter and exit liquidity pool. "
cumulativeTotalLiquidityPremiumUSD: BigDecimal!
" Number of unique daily users "
dailyActiveUsers: Int!
" Number of cumulative users "
cumulativeUniqueUsers: Int!
" Number of unique daily depositors "
dailyActiveDepositors: Int!
" Number of cumulative depositors "
cumulativeUniqueDepositors: Int!
" Number of unique daily borrowers "
dailyActiveBorrowers: Int!
" Number of cumulative borrowers "
cumulativeUniqueBorrowers: Int!
" Number of unique daily liquidators (accounts that performed liquidation) "
dailyActiveLiquidators: Int!
" Number of cumulative liquidators (accounts that performed liquidation) "
cumulativeUniqueLiquidators: Int!
" Number of unique daily liquidatees (accounts that got liquidated) "
dailyActiveLiquidatees: Int!