-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
1016 lines (847 loc) · 23.3 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 OraclePrice @entity {
id: ID!
symbol: String! @index
name: String!
blockchain: String! @index
timestamp: BigInt! @index
"BigDecimal"
price: String! @index
"BigDecimal"
supply: String!
decimals: Int!
}
type Transfer @entity {
id: ID!
blockNumber: Int! @index
timestamp: DateTime! @index
extrinsicHash: String @index
from: String!
to: String!
amount: BigInt! @index
fee: BigInt! # fee is calculated at the best effort and may be zero for some old extrinsics
remark: String
}
type ZenlinkInfo @entity {
id: ID!
updatedDate: DateTime!
"BigDecimal"
totalVolumeUSD: String!
"BigDecimal"
totalTvlUSD: String!
# transactions
txCount: Int!
factory: Factory!
stableSwapInfo: StableSwapInfo!
}
type Factory @entity {
# factory address
id: ID!
# pair info
pairCount: Int!
# total volume
"BigDecimal"
totalVolumeUSD: String!
"BigDecimal"
totalVolumeETH: String!
# untracked values - less confident USD scores
"BigDecimal"
untrackedVolumeUSD: String!
# total liquidity
"BigDecimal"
totalLiquidityUSD: String!
"BigDecimal"
totalLiquidityETH: String!
# transactions
txCount: Int!
}
type StableSwapInfo @entity {
id: ID!
poolCount: Int!
# total volume
"BigDecimal"
totalVolumeUSD: String!
"BigDecimal"
totalTvlUSD: String!
# transactions
txCount: Int!
swaps: [StableSwap!]! @derivedFrom(field: "stableSwapInfo")
}
type StableSwap @entity {
id: ID!
# swap address
address: String!
# base swap address
baseSwapAddress: String!
# number of tokens supported
numTokens: Int!
# supported tokens
tokens: [String!]!
# supported base tokens (for SwapNormal, this is same as tokens; for MetaSwap, this is the corresbonding base pool tokens)
baseTokens: [String!]!
# supported all tokens (metapool tokens plus basepool tokens)
allTokens: [String!]!
# token balances
balances: [String!]!
# liquidity provider token
lpToken: String!
lpTotalSupply: String!
# amplification coefficient
a: BigInt!
swapFee: BigInt!
adminFee: BigInt!
virtualPrice: BigInt!
stableSwapInfo: StableSwapInfo!
events: [StableSwapEvent!] @derivedFrom(field: "stableSwap")
exchanges: [StableSwapExchange!] @derivedFrom(field: "stableSwap")
stableSwapDayData: [StableSwapDayData!] @derivedFrom(field: "stableSwap")
stableSwapHourData: [StableSwapHourData!] @derivedFrom(field: "stableSwap")
farm: [Farm!] @derivedFrom(field: "stableSwap")
"BigDecimal"
tvlUSD: String!
"BigDecimal"
volumeUSD: String!
# " APR "
# apr: BigDecimal!
# " When APR was last updated "
# aprUpdatedAtTimestamp: BigInt!
}
type StableSwapEvent @entity {
id: ID!
stableSwap: StableSwap!
data: StableSwapEventData
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
union StableSwapEventData =
StableSwapNewFeeEventData
| StableSwapRampAEventData
| StableSwapStopRampAEventData
| StableSwapAddLiquidityEventData
| StableSwapRemoveLiquidityEventData
| StableSwapFlashLoanEventData
type StableSwapNewFeeEventData {
swapFee: BigInt!
adminFee: BigInt!
}
type StableSwapRampAEventData {
oldA: BigInt!
newA: BigInt!
initialTime: BigInt!
futureTime: BigInt!
}
type StableSwapStopRampAEventData {
currentA: BigInt!
time: BigInt!
}
type StableSwapAddLiquidityEventData {
provider: Bytes!
tokenAmounts: [BigInt!]!
fees: [BigInt!]!
invariant: BigInt
lpTokenSupply: BigInt!
}
type StableSwapRemoveLiquidityEventData {
provider: Bytes!
tokenAmounts: [BigInt!]!
fees: [BigInt!]
lpTokenSupply: BigInt
}
type StableSwapFlashLoanEventData {
caller: Bytes!
receiver: Bytes!
amountsOut: [BigInt!]!
}
type StableSwapExchange @entity {
id: ID!
stableSwap: StableSwap!
data: StableSwapExchangeData
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
union StableSwapExchangeData =
StableSwapTokenExchangeData
| StableSwapTokenExchangeUnderlyingData
type StableSwapTokenExchangeData {
buyer: Bytes!
boughtId: BigInt!
tokensBought: BigInt!
soldId: BigInt!
tokensSold: BigInt!
}
type StableSwapTokenExchangeUnderlyingData {
buyer: Bytes!
boughtId: BigInt!
tokensBought: BigInt!
soldId: BigInt!
tokensSold: BigInt!
}
type Token @entity {
# token address
id: ID!
# mirrored from the smart contract
symbol: String!
name: String!
decimals: Int!
# used for other stats like marketcap
totalSupply: String!
# token specific volume
"BigDecimal"
tradeVolume: String!
"BigDecimal"
tradeVolumeUSD: String!
"BigDecimal"
untrackedVolumeUSD: String!
# transactions across all pairs
txCount: Int!
# liquidity across all pairs
"BigDecimal"
totalLiquidity: String!
# derived prices
"BigDecimal"
derivedETH: String!
tokenDayData: [TokenDayData!]! @derivedFrom(field: "token")
pairDayDataBase: [PairDayData!]! @derivedFrom(field: "token0")
pairDayDataQuote: [PairDayData!]! @derivedFrom(field: "token1")
pairBase: [Pair!]! @derivedFrom(field: "token0")
pairQuote: [Pair!]! @derivedFrom(field: "token1")
}
type TokenTransfer @entity {
id: ID!
blockNumber: Int! @index
timestamp: DateTime! @index
extrinsicHash: String @index
from: String!
to: String!
currencyId: String!
amount: BigInt! @index
remark: String
}
type TokenDeposit @entity {
id: ID!
blockNumber: Int! @index
timestamp: DateTime! @index
extrinsicHash: String @index
who: String!
currencyId: String!
amount: BigInt! @index
}
type TokenWithdrawn @entity {
id: ID!
blockNumber: Int! @index
timestamp: DateTime! @index
extrinsicHash: String @index
who: String!
currencyId: String!
amount: BigInt! @index
}
type Pair @entity {
# pair address
id: ID!
# mirrored from the smart contract
token0: Token!
token1: Token!
"BigDecimal"
reserve0: String!
"BigDecimal"
reserve1: String!
"BigDecimal"
totalSupply: String!
# derived liquidity
"BigDecimal"
reserveETH: String!
"BigDecimal"
reserveUSD: String!
# used for separating per pair reserves and global
"BigDecimal"
trackedReserveETH: String!
# Price in terms of the asset pair
"BigDecimal"
token0Price: String!
"BigDecimal"
token1Price: String!
# lifetime volume stats
"BigDecimal"
volumeToken0: String!
"BigDecimal"
volumeToken1: String!
"BigDecimal"
volumeUSD: String!
"BigDecimal"
untrackedVolumeUSD: String!
txCount: Int!
# creation stats
createdAtTimestamp: DateTime!
createdAtBlockNumber: BigInt!
" APR "
# apr: BigDecimal!
# " When APR was last updated "
# aprUpdatedAtTimestamp: BigInt!
# Fields used to help derived relationship
liquidityProviderCount: Int! # used to detect new exchanges
# derived fields
pairHourData: [PairHourData!]! @derivedFrom(field: "pair")
pairDayData: [PairDayData!]! @derivedFrom(field: "pair")
liquidityPositions: [LiquidityPosition!]! @derivedFrom(field: "pair")
liquidityPositionSnapshots: [LiquidityPositionSnapshot!]!
@derivedFrom(field: "pair")
mints: [Mint!]! @derivedFrom(field: "pair")
burns: [Burn!]! @derivedFrom(field: "pair")
swaps: [Swap!]! @derivedFrom(field: "pair")
farm: [Farm!] @derivedFrom(field: "pair")
}
type User @entity {
# user address
id: ID!
liquidityPositions: [LiquidityPosition!] @derivedFrom(field: "user")
stableSwapLiquidityPositions: [StableSwapLiquidityPosition!]
@derivedFrom(field: "user")
stakePositions: [StakePosition!] @derivedFrom(field: "user")
# singleTokenLockPositions repeat with stake Positions
"BigDecimal"
usdSwapped: String!
}
type LiquidityPosition @entity {
id: ID!
user: User!
pair: Pair!
"BigDecimal"
liquidityTokenBalance: String!
}
type StableSwapLiquidityPosition @entity {
id: ID!
user: User!
stableSwap: StableSwap!
liquidityTokenBalance: String!
}
# saved over time for return calculations, gets created and never updated
type LiquidityPositionSnapshot @entity {
id: ID!
liquidityPosition: LiquidityPosition!
timestamp: DateTime! # saved for fast historical lookups
block: Int! # saved for fast historical lookups
user: User! # reference to user
pair: Pair! # reference to pair
"BigDecimal"
token0PriceUSD: String! # snapshot of token0 price
"BigDecimal"
token1PriceUSD: String! # snapshot of token1 price
"BigDecimal"
reserve0: String! # snapshot of pair token0 reserves
"BigDecimal"
reserve1: String! # snapshot of pair token1 reserves
"BigDecimal"
reserveUSD: String! # snapshot of pair reserves in USD
"BigDecimal"
liquidityTokenTotalSupply: String! # snapshot of pool token supply
"BigDecimal"
liquidityTokenBalance: String! # snapshot of users pool token balance
}
type Transaction @entity {
id: ID! # txn hash
blockNumber: BigInt!
timestamp: DateTime!
mints: [ID!]!
burns: [ID!]!
swaps: [ID!]!
}
type Mint @entity {
# transaction hash + "-" + index in mints Transaction array
id: ID!
transaction: Transaction!
timestamp: DateTime! # need this to pull recent txns for specific token or pair
pair: Pair!
# populated from the primary Transfer event
to: String!
liquidity: String!
# populated from the Mint event
sender: String
amount0: String
amount1: String
logIndex: Int
# derived amount based on available prices of tokens
amountUSD: String
# optional fee fields, if a Transfer event is fired in _mintFee
feeTo: String
feeLiquidity: String
}
type Burn @entity {
# transaction hash + "-" + index in mints Transaction array
id: ID!
transaction: Transaction!
timestamp: DateTime! # need this to pull recent txns for specific token or pair
pair: Pair!
# populated from the primary Transfer event
liquidity: String!
# populated from the Burn event
sender: String
amount0: String
amount1: String
to: String
logIndex: Int
# derived amount based on available prices of tokens
amountUSD: String
# mark uncomplete in ETH case
needsComplete: Boolean!
# optional fee fields, if a Transfer event is fired in _mintFee
feeTo: String
feeLiquidity: String
}
type Swap @entity {
# transaction hash + "-" + index in swaps Transaction array
id: ID!
transaction: Transaction!
timestamp: DateTime! # need this to pull recent txns for specific token or pair
pair: Pair!
# populated from the Swap event
sender: String!
from: String! # the EOA that initiated the txn
amount0In: String!
amount1In: String!
amount0Out: String!
amount1Out: String!
to: String!
logIndex: Int
# derived info
amountUSD: String!
}
type Bundle @entity {
id: ID!
"BigDecimal"
ethPrice: String! # price of ETH usd
}
type FactoryDayData @entity {
id: ID! # timestamp rounded to current day by dividing by 86400
date: DateTime!
dailyVolumeETH: String!
dailyVolumeUSD: String!
dailyVolumeUntracked: String!
totalVolumeETH: String!
totalLiquidityETH: String!
totalVolumeUSD: String! # Accumulate at each trade, not just calculated off whatever totalVolume is. making it more accurate as it is a live conversion
totalLiquidityUSD: String!
txCount: Int!
}
type PairHourData @entity {
id: ID!
hourStartUnix: BigInt! # unix timestamp for start of hour
pair: Pair!
# reserves
reserve0: String!
reserve1: String!
# total supply for LP historical returns
totalSupply: String!
# derived liquidity
reserveUSD: String!
# volume stats
hourlyVolumeToken0: String!
hourlyVolumeToken1: String!
hourlyVolumeUSD: String!
hourlyTxns: Int!
# " Used to calculate apr "
# cumulativeVolumeUSD: BigDecimal!
# apr: BigDecimal!
}
type PairDayData @entity {
id: ID!
date: DateTime!
pairAddress: String!
pair: Pair!
token0: Token!
token1: Token!
# reserves
reserve0: String!
reserve1: String!
# total supply for LP historical returns
totalSupply: String!
# derived String
reserveUSD: String!
# volume stats
dailyVolumeToken0: String!
dailyVolumeToken1: String!
dailyVolumeUSD: String!
dailyTxns: Int!
# " Used to calculate apr "
# cumulativeVolumeUSD: BigDecimal!
# apr: BigDecimal!
}
type TokenDayData @entity {
id: ID!
date: DateTime!
token: Token!
# volume stats
dailyVolumeToken: String!
dailyVolumeETH: String!
dailyVolumeUSD: String!
dailyTxns: Int!
# liquidity stats
totalLiquidityToken: String!
totalLiquidityETH: String!
totalLiquidityUSD: String!
# price stats
priceUSD: String!
}
type StableSwapDayData @entity {
id: ID!
date: DateTime!
stableSwap: StableSwap!
dailyVolumeUSD: String!
tvlUSD: String!
# " Used to calculate apr "
# cumulativeVolumeUSD: BigDecimal!
# apr: BigDecimal!
}
type StableSwapHourData @entity {
id: ID!
hourStartUnix: BigInt! # unix timestamp for start of hour
stableSwap: StableSwap!
hourlyVolumeUSD: String!
tvlUSD: String!
# " Used to calculate apr "
# cumulativeVolumeUSD: BigDecimal!
# apr: BigDecimal!
}
type StableDayData @entity {
id: ID!
date: DateTime!
dailyVolumeUSD: String!
tvlUSD: String!
}
type ZenlinkDayInfo @entity {
id: ID!
date: DateTime!
standardInfo: FactoryDayData!
stableInfo: StableSwapDayData!
dailyVolumeUSD: String!
tvlUSD: String!
}
type ZLKInfo @entity {
id: ID!
updatedDate: DateTime!
burn: BigInt!
}
type SingleTokenLockDayData @entity {
id: ID!
singleTokenLock: SingleTokenLock!
date: DateTime!
totalLiquidity: String!
totalLiquidityUSD: String!
totalLiquidityETH: String!
# " Used to calculate apr "
# rewardUSD: BigDecimal!
# apr: BigDecimal!
}
type SingleTokenLockHourData @entity {
id: ID!
hourStartUnix: BigInt! # unix timestamp for start of hour
singleTokenLock: SingleTokenLock!
totalLiquidity: String!
totalLiquidityUSD: String!
totalLiquidityETH: String!
# " Used to calculate apr "
# rewardUSD: BigDecimal!
# apr: BigDecimal!
}
type SingleTokenLock @entity {
id: ID!
token: Token!
# total liquidity
"BigDecimal"
totalLiquidityUSD: String!
"BigDecimal"
totalLiquidity: String!
totalLiquidityETH: String!
singleTokenLockDayData: [SingleTokenLockDayData!]
@derivedFrom(field: "singleTokenLock")
singleTokenLockHourData: [SingleTokenLockHourData!]
@derivedFrom(field: "singleTokenLock")
farm: [Farm!] @derivedFrom(field: "singleTokenLock")
}
type StakePosition @entity {
id: ID!
user: User!
farm: Farm!
liquidityStakedBalance: BigInt!
}
# type StakePositionSnapShot @entity {
# id: ID!
# user: User!
# farm: Farm!
# stakePosition: StakePosition!
# # liquidityStakedBalance: BigInt!
# }
# type PoolId = SingleTokenLock
# type PairFarm {
# pair: Pair
# farm: Farm
# }
# type StableSwapFarm {
# stableSwap: StableSwap
# farm: Farm
# }
# type SingleTokenLockFarm {
# singleTokenLock: SingleTokenLock
# farm: Farm
# }
type Farm @entity {
id: ID!
pid: BigInt!
singleTokenLock: SingleTokenLock
stableSwap: StableSwap
pair: Pair
stakeToken: String!
liquidityStaked: BigInt!
createdAtBlock: BigInt!
createdAtTimestamp: BigInt!
# stake apr
stakedUSD: String!
rewardUSDPerDay: String!
stakeApr: String!
incentives: [Incentive!]! @derivedFrom(field: "farm")
stakePositions: [StakePosition!] @derivedFrom(field: "farm")
}
type Incentive @entity {
id: ID!
farm: Farm!
rewardToken: Token!
rewardPerDay: String!
}
# Nabla entities
type Router @entity {
id: ID! # id can be the address of the router contract
swapPools: [SwapPool!]! @derivedFrom(field: "router")
backstopPool: [BackstopPool!]! @derivedFrom(field: "router")
paused: Boolean! # whether the router is paused
}
type NablaToken @entity {
id: ID! # id can be the address of the token contract
decimals: Int! # number of decimal places the token can be split into
name: String! # name of the token
symbol: String! # ticker symbol of the token
swapPools: [SwapPool!]! @derivedFrom(field: "token")
}
type SwapPool @entity {
id: ID! # id can be the address of the swap pool contract
name: String! # name of the swap pool LP token
symbol: String! # ticker symbol of the swap pool LP token
lpTokenDecimals: Int! # the decimals of the LP token
router: Router # link to the Router entity
backstop: BackstopPool! # link to the BackstopPool entity
token: NablaToken! # link to the Token entity
reserve: BigInt! # current usable balance of the pool
reserveWithSlippage: BigInt! # current actual balance of the pool
totalLiabilities: BigInt! # total Liquidity Provider (LP) deposits
totalSupply: BigInt! # total supply of LP tokens
paused: Boolean! # whether the swap pool is paused
feesHistory: [NablaSwapFee!]! @derivedFrom(field: "swapPool") # history of swap fees
apr: BigInt! # annual percentage rate of the swap pool
insuranceFeeBps: BigInt! # insurance fee in basis points
protocolTreasuryAddress: String # address of the treasury
}
type BackstopPool @entity {
id: ID! # id can be the address of the backstop pool contract
name: String! # name of the backstop pool LP token
symbol: String! # ticker symbol of the backstop pool LP token
lpTokenDecimals: Int! # the decimals of the LP token
router: Router! # link to the Router entity
token: NablaToken! # link to the NablaToken entity
reserves: BigInt! # current balance of the pool
totalSupply: BigInt! # total supply of LP tokens
paused: Boolean! # whether the backstop pool is paused
coveredSwapPools: [SwapPool!]! @derivedFrom(field: "backstop") # swap pools that are covered by the backstop pool
feesHistory: [NablaSwapFee!]! @derivedFrom(field: "backstopPool") # history of swap fees
apr: BigInt! # annual percentage rate of the backstop pool
}
type NablaSwapFee @entity {
id: ID! # # calculated from blockNumber - extrinsicIndex
lpFees: BigInt! # LP fee in `asset`
backstopFees: BigInt! # backstop fee in `asset`
protocolFees: BigInt! # protocol fee in `asset`
timestamp: BigInt! # timestamp of the swap event
swapPool: SwapPool! # link to the SwapPool entity
backstopPool: BackstopPool # link to the BackstopPool entity
}
type NablaSwap @entity {
id: ID! # calculated from blockNumber - extrinsicIndex
timestamp: DateTime! # need this to pull recent txns for specific token or pair
# from router Swap event
sender: String!
amountIn: BigInt!
amountOut: BigInt!
tokenIn: NablaToken!
tokenOut: NablaToken!
to: String!
swapFee: NablaSwapFee
}
type NablaBackstopLiquidityDeposit @entity {
id: ID! # calculated from blockNumber - extrinsicIndex
timestamp: DateTime!
# from backstop Mint event
sender: String!
poolSharesMinted: BigInt!
amountPoolTokensDeposited: BigInt!
backstopPool: BackstopPool!
}
type NablaSwapLiquidityDeposit @entity {
id: ID! # calculated from blockNumber - extrinsicIndex
timestamp: DateTime!
# from swap Mint event
sender: String!
poolSharesMinted: BigInt!
amountPoolTokensDeposited: BigInt!
swapPool: SwapPool!
}
type NablaBackstopLiquidityWithdrawal @entity {
id: ID! # calculated from blockNumber - extrinsicIndex
timestamp: DateTime!
# from backstop Burn event
sender: String!
poolSharesBurned: BigInt!
amountPoolTokensWithdrawn: BigInt!
backstopPool: BackstopPool!
}
type NablaSwapLiquidityWithdrawal @entity {
id: ID! # calculated from blockNumber - extrinsicIndex
timestamp: DateTime!
# from swap Burn event
sender: String!
poolSharesBurned: BigInt!
amountPoolTokensWithdrawn: BigInt!
swapPool: SwapPool!
}
type Vault @entity {
id: ID! # string concat{vaultId.accountId}-${vaultId.collateral}-${vaultId.wrapped}
accountId: String!
wrapped: String!
collateral: String!
vaultStellarPublicKey: String!
}
enum IssueRequestStatus {
PENDING
COMPLETED
CANCELLED
}
type IssueRequest @entity {
id: ID! # issueId
timestamp: DateTime!
opentime: BigInt!
period: BigInt! # we get this from storage upon reception of event
requester: String!
amount: BigInt!
vault: Vault! # we get asset from this entity
asset: String!
fee: BigInt!
griefingCollateral: BigInt!
stellarAddress: String!
status: IssueRequestStatus!
}
enum RedeemRequestStatus {
PENDING
COMPLETED
REIMBURSED
REIMBURSED_MINTED # Similar to REIMBURSED. Minted only happens if vault did not have enough collateral to reimburse.
RETRIED
}
type RedeemRequest @entity {
id: ID! #redeemId
timestamp: DateTime!
opentime: BigInt!
period: BigInt!
redeemer: String!
amount: BigInt!
asset: String!
vault: Vault!
fee: BigInt!
premium: BigInt!
transferFee: BigInt!
status: RedeemRequestStatus!
stellarAddress: String!
}
type Block @entity {
"BlockHeight-blockHash - e.g. 0001812319-0001c"
id: ID!
height: Int! @index
hash: Bytes! @index
parentHash: Bytes!
stateRoot: Bytes!
extrinsicsicRoot: Bytes!
specName: String!
specVersion: Int! @index
implName: String!
implVersion: Int!
timestamp: DateTime! @index
validator: Bytes @index
extrinsicsCount: Int!
callsCount: Int!
eventsCount: Int!
extrinsics: [Extrinsic]!
@derivedFrom(field: "block")
@cardinality(value: 1000)
calls: [Call]! @derivedFrom(field: "block") @cardinality(value: 1000)
events: [Event]! @derivedFrom(field: "block") @cardinality(value: 1000)
}
type ExtrinsicSignature {
address: JSON
signature: JSON
signedExtensions: JSON
}
type Extrinsic @entity {
id: ID!
block: Block!
call: Call!
index: Int!
version: Int!
signature: ExtrinsicSignature
tip: BigInt
fee: BigInt
success: Boolean @index
error: JSON
hash: Bytes! @index
calls: [Call]! @derivedFrom(field: "extrinsic")
events: [Event]! @derivedFrom(field: "extrinsic")
}
type Call @entity @index(fields: ["id", "pallet", "name"]) {
id: ID!
block: Block!
extrinsic: Extrinsic
parent: Call
address: [Int!]!
success: Boolean! @index
error: JSON
pallet: String! @index
name: String! @index
args: JSON
argsStr: [String]
subcalls: [Call]! @derivedFrom(field: "parent")
events: [Event]! @derivedFrom(field: "call")
}
type Event @entity @index(fields: ["id", "pallet", "name"]) {
"Event id - e.g. 0000000001-000000-272d6"
id: ID!
block: Block!
extrinsic: Extrinsic
call: Call
index: Int!
phase: String!
pallet: String! @index
name: String! @index
args: JSON
argsStr: [String]
}
enum CounterLevel {
Global