-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
819 lines (620 loc) · 18.8 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
# Subgraph Schema: Index DTF
# Version: 1.0.0
#############################
####### DTF FOLIO ######
#############################
type DTF @entity {
id: ID!
" Folio ERC20 token address "
token: Token!
" Revenue "
totalRevenue: BigInt!
" Protocol revenue "
protocolRevenue: BigInt!
" Governance revenue "
governanceRevenue: BigInt!
" External recipients revenue "
externalRevenue: BigInt!
" Folio deployer address "
deployer: Bytes!
" Proxy admin address "
proxyAdmin: Bytes!
" stDAO "
stToken: StakingToken
" staking token, backup in case of external staking token not indexed"
stTokenAddress: Bytes
" Onwer address - should be the timelock for governed tokens "
ownerAddress: Bytes!
" Owner governance address "
ownerGovernance: Governance
" Trading governance address "
tradingGovernance: Governance
" Deployed block number "
blockNumber: BigInt!
" Deployed timestamp "
timestamp: BigInt!
}
enum TradeState {
APPROVED
LAUNCHED
CLOSED
}
type Trade @entity {
" Trade ID "
id: ID!
" DTF "
dtf: DTF!
" Token from "
sell: Token!
" Token to "
buy: Token!
" Trade sold amount "
soldAmount: BigInt!
" Trade bought amount "
boughtAmount: BigInt!
" Trade start price "
startPrice: BigInt!
" Trade end price "
endPrice: BigInt!
" Sell limit spot "
sellLimitSpot: BigInt!
" Sell limit high "
sellLimitHigh: BigInt!
" Sell limit low "
sellLimitLow: BigInt!
" Buy limit spot "
buyLimitSpot: BigInt!
" Buy limit high "
buyLimitHigh: BigInt!
" Buy limit low "
buyLimitLow: BigInt!
" approvedSellLimitSpot "
approvedSellLimitSpot: BigInt!
" approvedBuyLimitSpot "
approvedBuyLimitSpot: BigInt!
" Approved start price "
approvedStartPrice: BigInt!
" Approved end price "
approvedEndPrice: BigInt!
" Available at (permissionless start) "
availableAt: BigInt!
" Timestamp launch timeout trades become unavailable if not launched within this time "
launchTimeout: BigInt!
" Trade start timestamp "
start: BigInt!
" Trade end timestamp "
end: BigInt!
" Approved timestamp "
approvedTimestamp: BigInt!
" Approved block number "
approvedBlockNumber: BigInt!
" Approved transaction hash "
approvedTransactionHash: String!
" Launched timestamp "
launchedTimestamp: BigInt!
" Launched block number "
launchedBlockNumber: BigInt!
" Launched transaction hash "
launchedTransactionHash: String!
" Closed timestamp "
closedTimestamp: BigInt!
" Closed block number "
closedBlockNumber: BigInt!
" Closed transaction hash "
closedTransactionHash: String!
" isKilled "
isKilled: Boolean!
" Trade state "
state: TradeState!
}
#############################
####### Token Metadata ######
#############################
enum TokenType {
DTF
VOTE
ASSET
}
type Token @entity {
" Smart contract address of the token "
id: ID!
" Address of the token "
address: 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!
" Total number of unique token holders who are currently holding more the token "
currentHolderCount: BigInt!
" Total number of cumulative unique token holders who held or are holding the token "
cumulativeHolderCount: BigInt!
" Total number of token transfer events "
transferCount: BigInt!
" Total number of token mint events "
mintCount: BigInt!
" Total number of token burn events "
burnCount: BigInt!
" Total token supply "
totalSupply: BigInt!
" Total token burned "
totalBurned: BigInt!
" Total token minted "
totalMinted: BigInt!
" Token type "
type: TokenType!
" List of token transfers "
transfers: [TransferEvent!]! @derivedFrom(field: "token")
" Token holder's balance "
holdersBalance: [AccountBalance!]! @derivedFrom(field: "token")
##### Snapshots #####
" Daily snapshot for this token "
dailyTokenSnapshot: [TokenDailySnapshot!]! @derivedFrom(field: "token")
}
###############################
####### Token Timeseries ######
###############################
type TokenDailySnapshot @entity {
" { Token Address }-{ # of days since Unix epoch time } "
id: ID!
" Token this snapshot is associated with "
token: Token!
" Daily total Supply of the token "
dailyTotalSupply: BigInt!
" number of accounts holding the token "
currentHolderCount: BigInt!
" number of cumulative unique holders "
cumulativeHolderCount: BigInt!
" Total number of events occurred in a day "
dailyEventCount: Int!
" Total number of transfers in a day "
dailyTransferCount: Int!
" Total number of token transfered in a day "
dailyTransferAmount: BigInt!
" Total number of mints in a day "
dailyMintCount: Int!
" Total number of token minted in a day "
dailyMintAmount: BigInt!
" Total number of burns in a day "
dailyBurnCount: Int!
" Total number of token burnt in a day "
dailyBurnAmount: BigInt!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
}
type TokenHourlySnapshot @entity {
" { Token Address }-{ # of hours since Unix epoch time } "
id: ID!
" Token this snapshot is associated with "
token: Token!
" Hourly total Supply of the token "
hourlyTotalSupply: BigInt!
" number of accounts holding this token "
currentHolderCount: BigInt!
" number of cumulative unique holders "
cumulativeHolderCount: BigInt!
" Total number of events occurred in an hour "
hourlyEventCount: Int!
" Total number of transfers in a hour "
hourlyTransferCount: Int!
" Total amount of token transfered in a hour "
hourlyTransferAmount: BigInt!
" Total number of mints in a hour "
hourlyMintCount: Int!
" Total amount of token minted in a hour "
hourlyMintAmount: BigInt!
" Total number of burns in a hour "
hourlyBurnCount: Int!
" Total number of token burnt in a hour "
hourlyBurnAmount: BigInt!
" Block number of this snapshot "
blockNumber: BigInt!
" Timestamp of this snapshot "
timestamp: BigInt!
}
##################################
##### Event-Level Data #####
##################################
interface Event {
" { Token ID }-{ Transaction hash }-{ Log index } "
id: ID!
" Transaction hash of the transaction that emitted this event "
hash: String!
" Event log index. For transactions that don't emit event, create arbitrary index starting from 0 "
logIndex: Int!
" The token this event belongs to "
token: Token!
" Nonce of the transaction that emitted this event "
nonce: Int!
" Address that received the tokens "
to: Account!
" Address that sent the tokens "
from: Account!
" Block number of this event "
blockNumber: BigInt!
" Timestamp of this event "
timestamp: BigInt!
}
# TODO: More generic event type to track all events
type TransferEvent implements Event @entity {
" { Token ID }-{ Transaction hash }-{ Log index } "
id: ID!
" Transaction hash of the transaction that emitted this event "
hash: String!
" Event log index. For transactions that don't emit event, create arbitrary index starting from 0 "
logIndex: Int!
" The token this event belongs to "
token: Token!
" Nonce of the transaction that emitted this event "
nonce: Int!
" Quantity of tokens transferred "
amount: BigInt!
" Account that received the tokens "
to: Account!
" Account that sent the tokens "
from: Account!
" Block number of this event "
blockNumber: BigInt!
" Timestamp of this event "
timestamp: BigInt!
}
##################################
######## Account MetaData ########
##################################
# An account is a unique Ethereum address
type Account @entity {
" Address of the account "
id: ID!
" Token transfers to this account "
transferTo: [TransferEvent!]! @derivedFrom(field: "to")
" Token transfers from this account "
transferFrom: [TransferEvent!]! @derivedFrom(field: "from")
" Token balances that this account holds "
balances: [AccountBalance!]! @derivedFrom(field: "account")
" Locks "
locks: [Lock!]! @derivedFrom(field: "account")
" Token balances snapshot that this account holds "
balancesSnapshot: [AccountBalanceDailySnapshot!]!
@derivedFrom(field: "account")
}
type AccountBalance @entity {
" { Address Of the Account }-{ Address of the Token }"
id: ID!
" Account address "
account: Account!
" Token address "
token: Token!
" Current account balance "
amount: BigInt!
" Delegate, used for stTokens "
delegate: Delegate
" Block number in which the balance was last modified "
blockNumber: BigInt!
" Timestamp in which the balance was last modified "
timestamp: BigInt!
}
###############################
###### Account Timeseries #####
###############################
type AccountBalanceDailySnapshot @entity {
" { Address Of the Account }-{ Address of the Token }-{ # of hours since Unix epoch time } "
id: ID!
" Account address "
account: Account!
" Token address "
token: Token!
" Current account balance "
amount: BigInt!
" Block number in which the balance was last modified "
blockNumber: BigInt!
" Timestamp in which the balance was last modified "
timestamp: BigInt!
}
###############################
###### Governance #####
###############################
enum ProposalState {
PENDING
ACTIVE
CANCELED
DEFEATED
SUCCEEDED
QUEUED
EXPIRED
EXECUTED
VETOED
}
enum VoteChoice {
FOR
AGAINST
ABSTAIN
}
type Governance @entity {
"Governance framework contract address"
id: ID!
"Name of the governance framework"
name: String!
"Version of the governance framework"
version: String!
" timelock "
timelock: GovernanceTimelock!
" Staking token entity, if this doesnt exist, DAO is not supported on UI? "
token: StakingToken!
"The delay before voting on a proposal may take place in blocks"
votingDelay: BigInt!
"The duration of voting on a proposal in blocks"
votingPeriod: BigInt!
"The number of votes required in order for a voter to become a proposer"
proposalThreshold: BigInt!
"The number of votes for a proposal to succeed."
quorumVotes: BigInt
"Quorum fraction numerator value. (OZ: quorum = totalSupply * numerator / denominator)"
quorumNumerator: BigInt
"Quorum fraction denominator value. (OZ: quorum = totalSupply * numerator / denominator)"
quorumDenominator: BigInt
"Total number of proposals created"
proposalCount: BigInt!
"Number of proposals currently queued for execution"
proposalsQueued: BigInt!
"Number of proposals currently executed"
proposalsExecuted: BigInt!
"Number of proposals currently canceled"
proposalsCanceled: BigInt!
" Proposal list "
proposals: [Proposal!]! @derivedFrom(field: "governance")
}
type GovernanceTimelock @entity {
"Timelock contract address"
id: ID!
"Governance contract address"
governance: Governance!
"Number of blocks that are required to pass from the time a proposal reaches quorum until its voting period ends"
executionDelay: BigInt!
"Guardians"
guardians: [String!]!
}
type Proposal @entity {
"Internal proposal ID, in this implementation it seems to be a autoincremental id"
id: ID!
"Transaction hash of the proposal creation"
txnHash: String!
"Proposal description in markdown format"
description: String!
"Governance Framework that proposal is part of"
governance: Governance!
"Delegate that proposed the proposal"
proposer: Delegate!
"State of the proposal"
state: ProposalState!
"The number of votes for a proposal to succeed."
quorumVotes: BigInt!
"Number of tokenholders at start of voting"
tokenHoldersAtStart: BigInt!
"Number of delegates at start of voting"
delegatesAtStart: BigInt!
"Number of delegates that voted against the proposal"
againstDelegateVotes: BigInt!
"Number of delegates that voted for the proposal"
forDelegateVotes: BigInt!
"Number of delegates that voted abstain to the proposal"
abstainDelegateVotes: BigInt!
"Total number of delegates that voted on the proposal"
totalDelegateVotes: BigInt!
"Weighted votes against the proposal"
againstWeightedVotes: BigInt!
"Weighted votes for the proposal"
forWeightedVotes: BigInt!
"Weighted votes abstaining to the proposal"
abstainWeightedVotes: BigInt!
"Total weighted for/against/abstaining votes"
totalWeightedVotes: BigInt!
"Votes associated to this proposal"
votes: [Vote!]! @derivedFrom(field: "proposal")
"Block number proposal was created in"
creationBlock: BigInt!
"Timestamp of block proposal was created in"
creationTime: BigInt!
"Block timestamp from where the voting starts"
voteStart: BigInt!
"Block timestamp from where the voting ends"
voteEnd: BigInt!
"Transaction hash of the proposal being queued"
queueTxnHash: String
"Block number proposal was queued in"
queueBlock: BigInt
"Timestamp of block proposal was queued in"
queueTime: BigInt
"Once the proposal is queued for execution it will have an ETA of the execution"
executionETA: BigInt
"Transaction hash of the proposal execution"
executionTxnHash: String
"Block number proposal was executed in"
executionBlock: BigInt
"Timestamp of block proposal was executed in"
executionTime: BigInt
"Transaction hash of the proposal cancellation"
cancellationTxnHash: String
"Block number proposal was canceled in"
cancellationBlock: BigInt
"Timestamp of block proposal was canceled in"
cancellationTime: BigInt
"Targets data for the change"
targets: [String!]
"Values data for the change"
values: [BigInt!]
"Signature data for the change"
signatures: [String!]
"Call data for the change"
calldatas: [Bytes!]
}
type Vote @entity(immutable: true) {
"Delegate ID + Proposal ID + Token ID"
id: ID!
"Whether the vote is in favour, against or abstaining to the proposal"
choice: VoteChoice!
"Voting weight expressed in the vote"
weight: BigInt!
"Reason for voting choice"
reason: String
"Delegate that emitted the vote"
voter: Delegate!
"Token ID of the vote"
tokenId: BigInt!
"Proposal that is being voted on"
proposal: Proposal!
"Block number vote is cast in"
block: BigInt!
"Timestamp of block vote was cast in"
blockTime: BigInt!
"Transaction hash of the vote"
txnHash: String!
"Log Index of the event"
logIndex: BigInt!
"Unique ID based on the blockTime and logIndex"
blockTimeId: String!
}
type VoteDailySnapshot @entity {
"Number of days from Unix epoch time"
id: ID!
"Proposal this snapshot is associated with"
proposal: Proposal!
"Weighted votes against the proposal at snapshot"
forWeightedVotes: BigInt!
"Weighted votes abstaining to the proposal at snapshot"
againstWeightedVotes: BigInt!
"Weighted votes for the proposal at snapshot"
abstainWeightedVotes: BigInt!
"Total weighted for/against/abstaining votes at snapshot"
totalWeightedVotes: BigInt!
"Block number of last block in snapshot"
blockNumber: BigInt!
"Timestamp of snapshot"
timestamp: BigInt!
}
type StakingToken @entity {
" Stake token address "
id: ID!
" Token entity for the sake of consistency but this token is not tracked "
underlying: Token
" Stake token "
token: Token!
" Governance "
governance: Governance
"Total number of delegates participating on the governance currently"
currentDelegates: BigInt!
"Total number of delegates that held delegated votes"
totalDelegates: BigInt!
"Total number of votes delegated expressed in the smallest unit of the token"
delegatedVotesRaw: BigInt!
"Total number of votes delegated expressed as a BigDecimal normalized value for the token"
delegatedVotes: BigDecimal!
" Delegates "
delegates: [Delegate!]! @derivedFrom(field: "token")
" DTFs "
dtfs: [DTF!]! @derivedFrom(field: "stToken")
" Governance frameworks "
daos: [Governance!]! @derivedFrom(field: "token")
}
type UnstakingManager @entity {
" Unstaking manager address "
id: ID!
" Staking token "
token: StakingToken!
}
type Lock @entity {
" { StakingToken Address }-{ Lock ID } "
id: ID!
" Lock id "
lockId: BigInt!
"Token address"
token: StakingToken!
"Amount of votes delegated to this delegate to be used on proposal votings expressed in the smallest unit of the token"
amount: BigInt!
"Account"
account: Account!
"Unlock time"
unlockTime: BigInt!
" created block "
createdBlock: BigInt!
" created timestamp "
createdTimestamp: BigInt!
" created txn hash "
createdTxnHash: String!
" cancelled block "
cancelledBlock: BigInt
" cancelled timestamp "
cancelledTimestamp: BigInt
" cancelled txn hash "
cancelledTxnHash: String
" claimed block "
claimedBlock: BigInt
" claimed timestamp "
claimedTimestamp: BigInt
" claimed txn hash "
claimedTxnHash: String
}
type Delegate @entity {
"A Delegate is any address that has been delegated with voting tokens by a token holder, id is {stTokenAddress}-{delegateAddress}"
id: ID!
"Delegate address"
address: String!
"Governance this delegate is related to"
token: StakingToken!
"Amount of votes delegated to this delegate to be used on proposal votings expressed in the smallest unit of the token"
delegatedVotesRaw: BigInt!
"Amount of votes delegated to this delegate to be used on proposal votings expressed as a BigDecimal normalized value"
delegatedVotes: BigDecimal!
"Total token holders that this delegate represents"
tokenHoldersRepresentedAmount: Int!
"Token holders that this delegate represents"
tokenHoldersRepresented: [AccountBalance!]! @derivedFrom(field: "delegate")
"Votes that a delegate has made in different proposals"
votes: [Vote!]! @derivedFrom(field: "voter")
"Number of proposals voted on"
numberVotes: Int!
"Proposals that the delegate has created"
proposals: [Proposal!]! @derivedFrom(field: "proposer")
}
type DelegateChange @entity(immutable: true) {
"Unique entity used to keep track of delegate changes"
id: ID!
"Token address"
tokenAddress: String!
"Address for delegator"
delegator: String!
"Address for delegate"
delegate: String!
"Address for previous delegate"
previousDelegate: String!
"Block time change happened"
blockTimestamp: BigInt!
"Transaction hash of the delegate change event"
txnHash: String!
"Log index for delegate change"
logIndex: BigInt!
"Block number of event"
blockNumber: BigInt!
}
type DelegateVotingPowerChange @entity(immutable: true) {
"Unique entity used to keep track of voting power delta"
id: ID!
"Token addresss"
tokenAddress: String!
"Address for delegate"
delegate: String!
"Previous voting power of delegate"
previousBalance: BigInt!
"New voting power of delegate"
newBalance: BigInt!
"Block time change happened"
blockTimestamp: BigInt!
"Transaction hash of the voting power change"
txnHash: String!
"Log index for delegate voting power change"
logIndex: BigInt!
"Block number of event"
blockNumber: BigInt!
}