-
Notifications
You must be signed in to change notification settings - Fork 241
/
schema-bridge.graphql
1384 lines (988 loc) · 44.5 KB
/
schema-bridge.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: Bridge
# Version: 1.2.0
# See https://github.com/messari/subgraphs/blob/master/docs/SCHEMA.md for details
enum Network {
ARBITRUM_ONE
ARWEAVE_MAINNET
AURORA
AVALANCHE
BASE
BOBA
BSC # aka BNB Chain
CELO
COSMOS
CRONOS
MAINNET # Ethereum Mainnet
FANTOM
FUSE
HARMONY
JUNO
MOONBEAM
MOONRIVER
NEAR_MAINNET
OPTIMISM
OSMOSIS
MATIC # aka Polygon
GNOSIS
UBIQ
SONGBIRD
ELASTOS
KARDIACHAIN
RSK
TELOS
XDC
ZYX
CSC
SYSCOIN
GOCHAIN
ETHEREUMCLASSIC
OKEXCHAIN
HOO
METER
NOVA_NETWORK
TOMOCHAIN
VELAS
THUNDERCORE
HECO
XDAIARB
ENERGYWEB
HPB
BOBA
KUCOIN
SHIDEN
THETA
SX
CANDLE
ASTAR
CALLISTO
WANCHAIN
METIS
ULTRON
STEP
DOGECHAIN
RONIN
KAVA
IOTEX
XLC
NAHMII
TOMBCHAIN
CANTO
KLAYTN
EVMOS
SMARTBCH
BITGERT
FUSION
OHO
ARB_NOVA
OASIS
REI
REICHAIN
GODWOKEN
POLIS
KEKCHAIN
VISION
HARMONY
PALM
CURIO
XDAI
UNKNOWN_NETWORK
}
enum ProtocolType {
EXCHANGE
LENDING
YIELD
BRIDGE
GENERIC
# Will add more
}
enum CrosschainTokenType {
WRAPPED # Minted by a bridge and backed by a canonical token in other network
CANONICAL
}
enum BridgePoolType {
LOCK_RELEASE
BURN_MINT
LIQUIDITY
}
enum BridgePermissionType {
PERMISSIONLESS # anyone can add new tokens to it
WHITELIST # tokens can be requested to be added and there is some vetting process
PRIVATE # a centralized party controls the bridge and decides what tokens are added
}
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
}
# CrosschainToken is the representation of a token from a different chain.
# For example, if you bridge USDC from Ethereum to Polygon, the token on Polygon is a CrosschainToken.
# CrosschainToken might or might not be canonical. It refers to the counterpart of the token on the other chain.
# If the token is wrapped on the current chain, CrosschainToken will be canonical on the opposite chain.
# It might also be the case that both the current chain token and its counterpart are canonical, in the case of liquidity bridges.
type CrosschainToken @entity(immutable: true) @regularPolling {
# We prepend the chainID because it is possible for a token to have the same address on multiple chains.
# ChainID is the id of the destination chain (not the one the subgraph is running on), and tokenID is the
# address of the token on the current chain.
" Bytes.fromI64(chainID).concat(tokenAddress) "
id: Bytes!
" The ID commonly used to signal to which chain a transaction is going. List of IDs: https://chainlist.org/ "
chainID: BigInt!
" The network where this token is deployed "
network: Network!
" The address on the external chain. It is necessary so we can link pools and routes among chans. "
address: Bytes!
" The type of token on the other chain "
type: CrosschainTokenType!
" The underlying token on the network where this subgraph running. Optional, since it is possible to swap to a token that doesn't exist in this chain. "
token: Token
}
enum RewardTokenType {
" For reward tokens awarded to LPs/lenders "
DEPOSIT
" For reward tokens awarded to borrowers "
BORROW
}
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!
}
#############################
##### 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. It should stay consistent among all deployments. "
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, Bridge, etc) "
type: ProtocolType!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of the entire protocol on this chain. This is the sum of totalValueExported + liquidity deposits "
totalValueLockedUSD: BigDecimal!
" Current PCV (Protocol Controlled Value). Only relevant for protocols with PCV. "
protocolControlledValueUSD: 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. In the case of bridges, revenue only includes that of transactions initiated in this chain "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. In the case of bridges, revenue only includes that of transactions initiated in this chain "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. In the case of bridges, revenue only includes that of transactions initiated in this chain "
cumulativeTotalRevenueUSD: BigDecimal!
" Number of cumulative unique addresses that interacted with the contracts on this chain or received funds from other chains "
cumulativeUniqueUsers: 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: [Pool!]! @derivedFrom(field: "protocol")
}
type BridgeProtocol 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, Bridge, etc) "
type: ProtocolType!
" Indicates if the bridge is permissionless, whitelisted, or private. Based on how is the process of adding new tokens to the bridge "
permissionType: BridgePermissionType!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of the entire protocol on this chain. This is the sum of totalValueExported + liquidity deposits "
totalValueLockedUSD: BigDecimal!
" USD value of all assets bridged away from this chain. In other words, value of assets locked in contracts in this chain because they are liquid in some other chain. "
totalValueExportedUSD: BigDecimal!
" USD value of all assets bridged into this chain from other chains "
totalValueImportedUSD: BigDecimal!
" Current PCV (Protocol Controlled Value). Only relevant for protocols with PCV. "
protocolControlledValueUSD: BigDecimal
" Revenue (originated in this chain) claimed by suppliers to the protocol. Mainly applies to Liquidity bridges. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Gross revenue (originated in this chain) for the protocol. Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. Includes fees to bridge validators (if any) "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" Total revenue (originated in this chain) "
cumulativeTotalRevenueUSD: BigDecimal!
" Cumulative USD value of tokens bridged to this chain "
cumulativeVolumeInUSD: BigDecimal!
" Cumulative USD value of tokens bridged from this chain "
cumulativeVolumeOutUSD: BigDecimal!
" Cumulative USD value of tokens bridged to or from this chain "
cumulativeTotalVolumeUSD: BigDecimal!
" Volume in minus volume out "
netVolumeUSD: BigDecimal!
" Number of cumulative unique addresses that interacted with the contracts on this chain or received funds from other chains. It should not include senders on other chains "
cumulativeUniqueUsers: Int!
" Number of unique addresses that bridged funds out of this chain "
cumulativeUniqueTransferSenders: Int!
" Number of unique a addresses that received funds from other chains into this one "
cumulativeUniqueTransferReceivers: Int!
" Total number of unique addresses that provided liquidity to the bridge on this chain "
cumulativeUniqueLiquidityProviders: Int!
" Total number of unique addresses that sent a message (not funds) through the bridge from this chain "
cumulativeUniqueMessageSenders: Int!
" Total number of transactions. Transactions include all entities that implement the Event interface. "
cumulativeTransactionCount: Int!
" Total number of transactions transferring funds from this chain "
cumulativeTransferOutCount: Int!
" Total number of transactions transferring funds to this chain "
cumulativeTransferInCount: Int!
" Total number of deposits providing liquidity to a liquidity based pool "
cumulativeLiquidityDepositCount: Int!
" Total number of withdrawals from a liquidity based pool. Refers to withdrawals of liquidity "
cumulativeLiquidityWithdrawCount: Int!
" Total number of messages (not transfers) sent through the bridge, originating in this chain "
cumulativeMessageSentCount: Int!
" Total number of messages (not transfers) sent through the bridge, received in this chain "
cumulativeMessageReceivedCount: Int!
" List of networks supported with which this side of the bridge connects "
supportedNetworks: [Network!]!
" Total number of pools. In a bridge, we call a pool the 'vault' where funds are locked/burned or minted/released when sending funds cross chain "
totalPoolCount: Int!
" We call a pool route each connection a token has with another chain. For example, if USDC can be bridged from the current chain to 2 others, it will have 2 pool routes. Not all assets can be bridged to all chains. "
totalPoolRouteCount: Int!
" Number of routes where the destination asset is canonical (i.e. it is not wrapped)"
totalCanonicalRouteCount: Int!
" Number of routes where the destination asset is a wrapped version of the source asset, usually minted by the bridge contract "
totalWrappedRouteCount: Int!
" Total number of tokens that can be bridged from or to this chain. Other tokens supported by the bridge but not on this chain are not counted "
totalSupportedTokenCount: 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: [Pool!]! @derivedFrom(field: "protocol")
}
###############################
##### Protocol Timeseries #####
###############################
type UsageMetricsDailySnapshot @entity(immutable: true) @dailySnapshot {
" ID is # of days since Unix epoch time (Bytes.fromI32(num)) "
id: Bytes!
" Same as the ID, but readable. Number of days since Unix "
day: Int!
" Protocol this snapshot is associated with "
protocol: BridgeProtocol!
##### User cumulatives #####
" Number of cumulative unique addresses that interacted with the contracts on this chain or received funds from other chains. It should not include senders on other chains "
cumulativeUniqueUsers: Int!
" Number of unique addresses that bridged funds out of this chain "
cumulativeUniqueTransferSenders: Int!
" Number of unique a addresses that received funds from other chains into this one "
cumulativeUniqueTransferReceivers: Int!
" Total number of unique addresses that provided liquidity to the bridge "
cumulativeUniqueLiquidityProviders: Int!
" Total number of unique addresses that sent a message through the bridge "
cumulativeUniqueMessageSenders: Int!
##### User Daily Acitivty #####
" Number of unique daily active users "
dailyActiveUsers: Int!
" Number of unique addresses that bridged funds out of this chain in the last day "
dailyActiveTransferSenders: Int!
" Number of unique addresses that received funds from other chains into this one in the last day "
dailyActiveTransferReceivers: Int!
" Number of unique addresses that provided liquidity to the bridge in a day "
dailyActiveLiquidityProviders: Int!
" Number of unique addresses that sent a message through the bridge in a day "
dailyActiveMessageSenders: Int!
##### Transaction counts #####
" Total number of transactions. Transactions include all entities that implement the Event interface. "
cumulativeTransactionCount: Int!
" Total number of transactions occurred in a day. Transactions include all entities that implement the Event interface. "
dailyTransactionCount: Int!
" Total number of transactions transferring funds from this chain "
cumulativeTransferOutCount: Int!
" Total number of transactions transferring funds from this chain in a day "
dailyTransferOutCount: Int!
" Total number of transactions transferring funds to this chain "
cumulativeTransferInCount: Int!
" Total number of transactions transferring funds to this chain in a day "
dailyTransferInCount: Int!
" Total number of deposits providing liquidity to a liquidity based pool "
cumulativeLiquidityDepositCount: Int!
" Total number of deposits providing liquidity to a liquidity based pool in a day "
dailyLiquidityDepositCount: Int!
" Total number of withdrawals from a liquidity based pool. Refers to withdrawals of liquidity "
cumulativeLiquidityWithdrawCount: Int!
" Total number of withdrawals from a liquidity based pool in a day "
dailyLiquidityWithdrawCount: Int!
" Total number of messages (not transfers) sent through the bridge, originating in this chain "
cumulativeMessageSentCount: Int!
" Total number of messages sent through the bridge, originating in this chain in a day"
dailyMessageSentCount: Int!
" Total number of messages (not transfers) sent through the bridge, received in this chain "
cumulativeMessageReceivedCount: Int!
" Total number of messages sent through the bridge, received in this chain in a day "
dailyMessageReceivedCount: Int!
##### Misc #####
" Total number of pools "
totalPoolCount: Int!
" We call a pool route each connection a token has with another chain. For example, if USDC can be bridged from the current chain to 2 others, it will have 2 pool routes. Not all assets can be bridged to all chains. "
totalPoolRouteCount: Int!
" Number of routes where the destination asset is canonical (i.e. it is not wrapped)"
totalCanonicalRouteCount: Int!
" Number of routes where the destination asset is a wrapped version of the source asset, usually minted by the bridge contract "
totalWrappedRouteCount: Int!
" Total number of tokens that can be bridged from or to this chain. Other tokens supported by the bridge but not on this chain are not counted "
totalSupportedTokenCount: Int!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
}
type UsageMetricsHourlySnapshot @entity(immutable: true) @hourlySnapshot {
" { Bytes.fromI32(num) } # of hours since Unix epoch time "
id: Bytes!
" Same as the ID, but readable. Number of hours since Unix "
hour: Int!
" Protocol this snapshot is associated with "
protocol: BridgeProtocol!
##### User cumulatives #####
" Number of cumulative unique addresses that interacted with the contracts on this chain or received funds from other chains. It should not include senders on other chains "
cumulativeUniqueUsers: Int!
" Number of unique addresses that bridged funds out of this chain "
cumulativeUniqueTransferSenders: Int!
" Number of unique a addresses that received funds from other chains into this one "
cumulativeUniqueTransferReceivers: Int!
" Total number of unique addresses that provided liquidity to the bridge "
cumulativeUniqueLiquidityProviders: Int!
" Total number of unique addresses that sent a message through the bridge "
cumulativeUniqueMessageSenders: Int!
##### User Hourly Acitivty #####
" Number of unique hourly active users "
hourlyActiveUsers: Int!
" Number of unique addresses that bridged funds out of this chain in the last hour "
hourlyActiveTransferSenders: Int!
" Number of unique addresses that received funds from other chains into this one in the last hour "
hourlyActiveTransferReceivers: Int!
" Number of unique addresses that provided liquidity to the bridge in an hour "
hourlyActiveLiquidityProviders: Int!
" Number of unique addresses that sent a message through the bridge in an hour "
hourlyActiveMessageSenders: Int!
##### Transaction counts #####
" Total number of transactions. Transactions include all entities that implement the Event interface. "
cumulativeTransactionCount: Int!
" Total number of transactions occurred in an hour. Transactions include all entities that implement the Event interface. "
hourlyTransactionCount: Int!
" Total number of transactions transferring funds from this chain "
cumulativeTransferOutCount: Int!
" Total number of transactions transferring funds from this chain in an hour "
hourlyTransferOutCount: Int!
" Total number of transactions transferring funds to this chain "
cumulativeTransferInCount: Int!
" Total number of transactions transferring funds to this chain in an hour "
hourlyTransferInCount: Int!
" Total number of deposits providing liquidity to a liquidity based pool "
cumulativeLiquidityDepositCount: Int!
" Total number of deposits providing liquidity to a liquidity based pool in an hour "
hourlyLiquidityDepositCount: Int!
" Total number of withdrawals from a liquidity based pool. Refers to withdrawals of liquidity "
cumulativeLiquidityWithdrawCount: Int!
" Total number of withdrawals from a liquidity based pool in an hour "
hourlyLiquidityWithdrawCount: Int!
" Total number of messages (not transfers) sent through the bridge, originating in this chain "
cumulativeMessageSentCount: Int!
" Total number of messages sent through the bridge, originating in this chain in an hour"
hourlyMessageSentCount: Int!
" Total number of messages (not transfers) sent through the bridge, received in this chain "
cumulativeMessageReceivedCount: Int!
" Total number of messages sent through the bridge, received in this chain in an hour "
hourlyMessageReceivedCount: Int!
##### Misc #####
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
}
type FinancialsDailySnapshot @entity(immutable: true) @dailySnapshot {
" ID is # of days since Unix epoch time (Bytes.fromI32(num)) "
id: Bytes!
" Same as the ID, but readable. Number of days since Unix "
day: Int!
" Protocol this snapshot is associated with "
protocol: BridgeProtocol!
" Current TVL (Total Value Locked) of the entire protocol "
totalValueLockedUSD: BigDecimal!
" USD value of all assets bridged away from this chain. In other words, value of assets locked in contracts in this chain because they are liquid in some other chain. "
totalValueExportedUSD: BigDecimal!
" USD value of all assets bridged into this chain from other chains "
totalValueImportedUSD: BigDecimal!
" Current PCV (Protocol Controlled Value). Only relevant for protocols with PCV. "
protocolControlledValueUSD: BigDecimal
##### Revenues #####
" 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!
" Gross 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!
" All 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!
##### Volumes #####
" USD value of all tokens bridged to this chain in a day "
dailyVolumeInUSD: BigDecimal!
" Cumulative USD value of tokens bridged to this chain in a day "
cumulativeVolumeInUSD: BigDecimal!
" USD value of all tokens bridged from this chain in a day "
dailyVolumeOutUSD: BigDecimal!
" Cumulative USD value of tokens bridged from this chain "
cumulativeVolumeOutUSD: BigDecimal!
" Daily volume in minus volume out "
dailyNetVolumeUSD: BigDecimal!
" Cumulative volume in minus volume out "
cumulativeNetVolumeUSD: BigDecimal!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
}
###########################
##### Pool-Level Data #####
###########################
type Pool @entity @regularPolling {
" Smart contract address of the pool "
id: Bytes!
" The protocol this pool belongs to "
protocol: BridgeProtocol!
" Name of the pool (e.g. Curve.fi DAI/USDC/USDT) "
name: String
" Symbol of liquidity pool (e.g. 3CRV) "
symbol: String
" A unique identifier that can relate multiple pools together. e.g. a common address that they all share. This is useful for pools with multiple input tokens "
relation: Bytes
" The type of the pool, determined by the type of the input tokens. "
type: BridgePoolType!
" Tokens that can be bridged from and to this pool "
inputToken: Token!
" Equivalent to inputTokens but in the other networks "
destinationTokens: [CrosschainToken!]!
" Info about pool usage to and from each chain the pool is connected to "
routes: [PoolRoute!]!
# Generally protocols accept one or multiple tokens and mint tokens to the depositor to track ownership
# Some protocols don't mint any tokens to track ownership, in that case outputToken is null.
" Token that is minted to track ownership of a liquidity position, if the pool is liquidity based. "
outputToken: Token
" Aditional 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!]
" Creation timestamp "
createdTimestamp: BigInt!
" Creation block number "
createdBlockNumber: BigInt!
##### Quantitative Data #####
" Only for MINT/BURN pools: the current supply of the minted token on this chain. "
mintSupply: BigInt
" Amount of input tokens in the pool "
inputTokenBalance: BigInt!
" Current TVL (Total Value Locked) of this pool in USD (only applies to LOCK_RELEASE and LIQUIDITY pools)"
totalValueLockedUSD: BigDecimal!
" USD value of all assets bridged into or away from this chain through this pool. For mint/burn pools, this is the USD value of the minted supplies. For lock/release pools, this is the USD value of the input token balance. "
netValueExportedUSD: BigDecimal!
" All revenue generated by the pool, from transactions originating in this network, accrued to the supply side. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" All revenue generated by the pool, from transactions originating in this network, accrued to the protocol. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" All revenue generated by the pool. "
cumulativeTotalRevenueUSD: BigDecimal!
" Total volume bridged to this pool in token amounts "
cumulativeVolumeIn: BigInt!
" Total volume bridged from this pool in token amounts "
cumulativeVolumeOut: BigInt!
" cumulativeIn - cumulativeOut "
netVolume: BigInt!
" Total volume bridged to this pool in USD "
cumulativeVolumeInUSD: BigDecimal!
" Total volume bridged from this pool in USD "
cumulativeVolumeOutUSD: BigDecimal!
" cumulativeInUSD - cumulativeOutUSD "
netVolumeUSD: BigDecimal!
" Total supply of output token. "
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 #####
" Pool daily snapshots "
dailySnapshots: [PoolDailySnapshot!]! @derivedFrom(field: "pool")
" Pool hourly snapshots "
hourlySnapshots: [PoolHourlySnapshot!]! @derivedFrom(field: "pool")
_lastDailySnapshotTimestamp: BigInt
_lastHourlySnapshotTimestamp: BigInt
" Internal field for the SDK to be able to calculate total value imported/exported for liquidity based pools "
_inputTokenLiquidityBalance: BigInt
}
type PoolRoute @entity @regularPolling {
" Bytes.fromUTF(({Pool ID}-{crossToken}-{lowerChainID}-{greaterChainID}) "
id: Bytes!
" Pool this route belongs to "
pool: Pool!
" A route connects the pool on this chain to its homologous on the other chain, this field refers to the type of the pool on the other chain. "
counterType: BridgePoolType
" The token sent or received on the current chain "
inputToken: Token!
" The token sent or received on the opposite chain "
crossToken: CrosschainToken!
" Indicates if the route contains two different tokens that can be swapped while bridging "
isSwap: Boolean!
" total volume received through this route in inputToken "
cumulativeVolumeIn: BigInt!
" total volume sent through this route in inputToken "
cumulativeVolumeOut: BigInt!
" total volume received through this route in USD "
cumulativeVolumeInUSD: BigDecimal!
" total volume sent through this route in USD "
cumulativeVolumeOutUSD: BigDecimal!
" Timestamp in which this route is created or first time used "
createdTimestamp: BigInt!
" Block number in which this route is created or first time used "
createdBlockNumber: BigInt!
}
type PoolDailySnapshot @entity(immutable: true) @dailySnapshot {
" poolAddress.concatI32(daysSinceUnix) "
id: Bytes!
" Number of days since Unix "
day: Int!
" The protocol this snapshot belongs to "
protocol: BridgeProtocol!
" The pool this snapshot belongs to "
pool: Pool!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of this pool "
totalValueLockedUSD: BigDecimal!
" USD value of all assets bridged into or away from this chain through this pool. For mint/burn pools, this is the USD value of the minted supplies. For lock/release pools, this is the USD value of the input token balance. "
netValueExportedUSD: BigDecimal!
" All revenue generated by the pool, accrued to the supply side. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Daily revenue generated by the pool, accrued to the supply side. "
dailySupplySideRevenueUSD: BigDecimal!
" All revenue generated by the pool, accrued to the protocol. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" Daily revenue generated by the pool, accrued to the protocol. "
dailyProtocolSideRevenueUSD: BigDecimal!
" All revenue generated by the pool. "
cumulativeTotalRevenueUSD: BigDecimal!
" Daily revenue generated by the pool. "
dailyTotalRevenueUSD: BigDecimal!
##### Volumes #####"
cumulativeVolumeIn: BigInt!
dailyVolumeIn: BigInt!
cumulativeVolumeInUSD: BigDecimal!
dailyVolumeInUSD: BigDecimal!
cumulativeVolumeOut: BigInt!
dailyVolumeOut: BigInt!
cumulativeVolumeOutUSD: BigDecimal!
dailyVolumeOutUSD: BigDecimal!
netCumulativeVolume: BigInt!
netCumulativeVolumeUSD: BigDecimal!
netDailyVolume: BigInt!
netDailyVolumeUSD: BigDecimal!
routes: [PoolRouteSnapshot!]!
" Only for MINT/BURN pools: the current supply of the minted token. "
mintSupply: BigInt
" Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. "
inputTokenBalance: BigInt!
" 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!]
}
type PoolHourlySnapshot @entity(immutable: true) @hourlySnapshot {
" poolAddress.concatI32(hoursSinceUnix) "
id: Bytes!
" Same as the ID, but readable. Number of hours since Unix "
hour: Int!
" The protocol this snapshot belongs to "
protocol: BridgeProtocol!
" The pool this snapshot belongs to "
pool: Pool!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
##### Quantitative Data #####
" Current TVL (Total Value Locked) of this pool "
totalValueLockedUSD: BigDecimal!
" USD value of all assets bridged into or away from this chain through this pool. For mint/burn pools, this is the USD value of the minted supplies. For lock/release pools, this is the USD value of the input token balance. "
netValueExportedUSD: BigDecimal!
" All revenue generated by the pool, accrued to the supply side. "
cumulativeSupplySideRevenueUSD: BigDecimal!
" Hourly revenue generated by the pool, accrued to the supply side. "
hourlySupplySideRevenueUSD: BigDecimal!
" All revenue generated by the pool, accrued to the protocol. "
cumulativeProtocolSideRevenueUSD: BigDecimal!
" Hourly revenue generated by the pool, accrued to the protocol. "
hourlyProtocolSideRevenueUSD: BigDecimal!
" All revenue generated by the pool. "
cumulativeTotalRevenueUSD: BigDecimal!
" Hourly revenue generated by the pool. "
hourlyTotalRevenueUSD: BigDecimal!
##### Volumes #####"
cumulativeVolumeIn: BigInt!
hourlyVolumeIn: BigInt!
cumulativeVolumeInUSD: BigDecimal!
hourlyVolumeInUSD: BigDecimal!
cumulativeVolumeOut: BigInt!
hourlyVolumeOut: BigInt!
cumulativeVolumeOutUSD: BigDecimal!
hourlyVolumeOutUSD: BigDecimal!
netCumulativeVolume: BigInt!
netCumulativeVolumeUSD: BigDecimal!
netHourlyVolume: BigInt!
netHourlyVolumeUSD: BigDecimal!
routes: [PoolRouteSnapshot!]!
" Only for MINT/BURN pools: the current supply of the minted token. "
mintSupply: BigInt
" Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. "
inputTokenBalance: BigInt!
" 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 (not hour), 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 (not hour), in USD value. This should be ideally calculated as the theoretical rate instead of the realized amount. "
rewardTokenEmissionsUSD: [BigDecimal!]
}
type PoolRouteSnapshot @entity(immutable: true) @hourlySnapshot {
" poolRouteID.concat(poolSnapshotID) "
id: Bytes!
" PoolRoute this snapshot belongs to "
poolRoute: PoolRoute!
" Timestamp of this snapshot "
timestamp: BigInt!
" Block number of this snapshot "
blockNumber: BigInt!
" volume received through this route during the time of the snapshot period (hourly/daily) "