-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
939 lines (757 loc) · 27.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
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
# For generating introspection query purposes
" Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. "
scalar Bytes
" Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint25`6 types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. "
scalar BigInt
" Fake query, needed to generate introspection query. "
type Query @entity {
id: ID!
}
# Types
#############################
########## Tokens ###########
#############################
"""
Interface representing a generic token. Each entity implementing this interface can be queried as Token.
"""
interface Token {
" The address of the Token Smart Contract. "
id: ID!
" The name of the token, mirrored from the smart contract. "
name: String
" The symbol of the token, mirrored from the smart contract. "
symbol: String
}
"""
An [ERC20 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-20), of type Token.
"""
type ERC20Contract implements Token @entity(immutable: true) {
" The address of the [ERC20 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-20). "
id: ID!
" The name of the token, mirrored from the smart contract. "
name: String
" The symbol of the token, mirrored from the smart contract. "
symbol: String
" The number of decimals of the token, mirrored from the smart contract. "
decimals: Int!
}
"""
Wrapped [ERC20 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-20). Used for token voting.
"""
type ERC20WrapperContract implements Token @entity(immutable: true) {
" The address of the [ERC20 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-20). "
id: ID!
" The name of the wrapped token, mirrored from the smart contract. "
name: String
" The symbol of the wrapped token, mirrored from the smart contract. "
symbol: String
" The number of decimals of the wrapped token, mirrored from the smart contract. "
decimals: Int!
" The underlying [ERC20 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-20) this wrapper represents. "
underlyingToken: ERC20Contract!
}
"""
[ERC721 Token Standard](https://eips.ethereum.org/EIPS/eip-721), Non-Fungible Token (NFT), of type Token.
"""
type ERC721Contract implements Token @entity(immutable: true) {
" The address of the [ERC721 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-721). "
id: ID!
" The name of the token, mirrored from the smart contract. "
name: String
" The symbol of the token, mirrored from the smart contract. "
symbol: String
}
"""
[ERC1155 Multi-Token Standard](https://eips.ethereum.org/EIPS/eip-1155), fungible, non-fungible, and semi-fungible tokens all in one contract,
type of Token.
"""
type ERC1155Contract implements Token @entity(immutable: true) {
" The address of the [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155). "
id: ID!
" The name of the [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155). "
name: String
" The symbol of the [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155). "
symbol: String
}
###########################
##### Token Balances ######
###########################
"""
Balance of the DAO for any kind of token. Each entity implementing this interface can be queried as TokenBalance.
"""
interface TokenBalance {
" The concatenation of DAO Smart contract address and Token Smart Contract address. Joined by '_'. "
id: ID!
" The DAO that holds the Tokens"
dao: Dao!
" The block timestamp of the last update (transfer) for this token balance. "
lastUpdated: BigInt!
}
"""
The ERC20 Token balances for the DAO.
"""
type ERC20Balance implements TokenBalance @entity {
" The concatenation of DAO Smart contract address and Token Smart contract address. Joined by '_'. "
id: ID!
" The [ERC20 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-20) instance. "
token: ERC20Contract!
" The DAO that holds the ERC20 token. "
dao: Dao!
" The amount of ERC20 tokens held by the DAO. "
balance: BigInt!
" The block timestamp of the last update (transfer) for this token balance. "
lastUpdated: BigInt!
}
"""
The Native token balances of the DAO, representing the amount of the blockchain's native currency
(e.g., Ether on Ethereum, MATIC on Polygon) held by the DAO.
"""
type NativeBalance implements TokenBalance @entity {
" The concatenation of DAO Smart contract address and Token Smart contract address. Joined by '_'. "
id: ID!
" The DAO that holds the native tokens"
dao: Dao!
" The amount of native tokens held by the DAO. "
balance: BigInt!
" The block timestamp of the last update (transfer) for this native token balance. "
lastUpdated: BigInt!
}
"""
The NFT balances of the DAO. Including all Token IDs held by the DAO per [ERC721 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-721).
"""
type ERC721Balance implements TokenBalance @entity {
" The concatenation of DAO Smart Contract address and [ERC721 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-721) address. Joined by '_'. "
id: ID!
" The [ERC721 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-721) instance. "
token: ERC721Contract!
" The DAO that holds tokens from a [ERC721 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-721). "
dao: Dao!
" The NFTs from one ERC721 Contract held by the DAO. "
tokenIds: [BigInt!]!
" The block timestamp of the last update (transfer) for this token balance. "
lastUpdated: BigInt!
}
"""
The ERC1155 Token balances of the DAO. Including all Token IDs and it's amounts held by the DAO per [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155).
"""
type ERC1155Balance implements TokenBalance @entity {
" The concatenation of DAO Smart Contract address and [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155) address. Joined by '_'. "
id: ID!
" The [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155) instance. "
token: ERC1155Contract!
" The DAO that holds tokens from a [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155). "
dao: Dao!
" Balance for each token ID from an [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155). "
balances: [ERC1155TokenIdBalance!]! @derivedFrom(field: "balance")
" The URI of the [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155). "
metadataUri: String!
" The block timestamp of the last update (transfer) for this token balance. "
lastUpdated: BigInt!
}
"""
The DAO token balance for each token within an [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155)
"""
type ERC1155TokenIdBalance @entity {
" The concatenation of DAO Smart Contract address, [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155) and token ID. Joined by '_'. "
id: ID!
" One to Many relationship linking with ERC1155Balance entity. "
balance: ERC1155Balance!
" The ID for each different token in an [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155) held by the DAO. "
tokenId: BigInt!
" The number of tokens held by the DAO per [ERC1155 Token Smart Contract](https://eips.ethereum.org/EIPS/eip-1155) and token ID. "
amount: BigInt!
" The block timestamp of the last update (transfer) for this token balance. "
lastUpdated: BigInt!
}
###########################
##### Token Transfers #####
###########################
"""
Classifies the types of transfers from the DAO's point of view.
"""
enum TransferType {
"""
When a DAO facilitates a transfer and neither the source nor the destination addresses match the DAO's. The DAO must
have token approval to execute the transfer via proposal, acting as an intermediary in the process.
"""
ExternalTransfer
" A withdrawal form the DAO treasury. Executed by the DAO via proposal calling `transfer`. "
Withdraw
"""
A deposit to the DAO treasury. Using either the DAO `deposit` function or executed by the DAO via proposal calling `transferFrom` as an action to transfer to itself.
The DAO must have token approval.
"""
Deposit
}
"""
Interface representing a generic token transfer associated with the DAO. Each entity implementing this interface can be queried as TokenTransfer (refer to `Enum` `TransferType` for a better understanding of transfers associated with the DAO meaning).
"""
interface TokenTransfer {
" The concatenation of the transfer transaction hash, the log index and the action index. Joined by '_'. "
id: ID!
" The DAO that manages the transfer. "
dao: Dao!
" The Ethereum address from which the tokens are being transferred. "
from: Bytes!
" The Ethereum address receiving the transfer. "
to: Bytes!
" The type of transfer (External, Withdraw, Deposit) from the DAO's POV. "
type: TransferType!
" The associated DAO proposal, if applicable. Using the DAO `deposit` function there's no need for proposal. "
proposal: IProposal
" The hash of the transfer to track the transaction. "
txHash: Bytes!
" The timestamp of the block including transfer. "
createdAt: BigInt!
}
"""
Transfers of ERC20 token associated with the DAO, including transfers sent to, received by, or intermediated by the DAO (refer to `Enum` `TransferType` for a better understanding of transfers associated with the DAO meaning).
"""
type ERC20Transfer implements TokenTransfer @entity(immutable: true) {
" The concatenation of the transfer transaction hash, the log index and the action index. Joined by '_'. "
id: ID!
" The DAO that manages the transfer. "
dao: Dao!
" The ERC20 Smart Contract Token entity involved in the transfer. "
token: Token!
" The amount of ERC20 token transferred. "
amount: BigInt!
" The Ethereum address from which the ERC20 tokens are being transferred. "
from: Bytes!
" The Ethereum address receiving the ERC20 tokens. "
to: Bytes!
" The associated DAO proposal, if applicable. Using the DAO `deposit` function there's no need for proposal. "
proposal: IProposal
" The type of transfer (External, Withdraw, Deposit) from the DAO's POV. "
type: TransferType!
" The hash of the ERC20 token transfer to track the transaction. "
txHash: Bytes!
" The timestamp of the block including the ERC20 token transfer. "
createdAt: BigInt!
}
"""
Transfers of ERC721 token associated with the DAO, including transfers sent to, received by, or intermediated by the DAO (refer to `Enum` `TransferType` for a better understanding of transfers associated with the DAO meaning).
"""
type ERC721Transfer implements TokenTransfer @entity(immutable: true) {
" The concatenation of the transfer transaction hash, the log index and the action index. Joined by '_'. "
id: ID!
" The DAO that manages the transfer. "
dao: Dao!
" The ERC721 Smart Contract Token entity involved in the transfer. "
token: ERC721Contract!
" The ID of the transferred token. "
tokenId: BigInt!
" The Ethereum address from which the ERC721 token is being transferred. "
from: Bytes!
" The Ethereum address receiving the ERC721 token. "
to: Bytes!
" The associated DAO proposal, if applicable. Using the DAO `deposit` function there's no need for proposal. "
proposal: IProposal
" The type of transfer (External, Withdraw, Deposit) from the DAO's POV. "
type: TransferType!
" The hash of the ERC721 token transfer to track the transaction. "
txHash: Bytes!
" The timestamp of the block including the ERC721 token transfer . "
createdAt: BigInt!
}
"""
Transfers of ERC1155 token associated with the DAO, including transfers sent to, received by, or intermediated by the DAO (refer to `Enum` `TransferType` for a better understanding of transfers associated with the DAO meaning).
"""
type ERC1155Transfer implements TokenTransfer @entity(immutable: true) {
" The concatenation of the transfer transaction hash, the log index and the action index. Joined by '_'. "
id: ID!
" The DAO that manages the transfer. "
dao: Dao!
" The ERC1155 Smart Contract Token entity involved in the transfer. "
token: ERC1155Contract!
" The ID of the transferred token. "
tokenId: BigInt!
" The amount of transferred tokens. "
amount: BigInt!
" The Ethereum address performing the token transfer. "
operator: Bytes!
" The Ethereum address from which the tokens are being transferred. "
from: Bytes!
" The Ethereum address receiving the tokens. "
to: Bytes!
" The associated DAO proposal, if applicable. Using the DAO `deposit` function there's no need for proposal. "
proposal: IProposal
" The type of transfer (External, Withdraw, Deposit) from the DAO's POV. "
type: TransferType!
" The hash of the ERC1155 token transfer to track the transaction. "
txHash: Bytes!
" The timestamp of the block including the ERC1155 token transfer. "
createdAt: BigInt!
}
"""
Transfers of Native token associated with the DAO, including transfers sent to, received by, or intermediated by the DAO (refer to `Enum` `TransferType` for a better understanding of transfers associated with the DAO meaning).
"""
type NativeTransfer implements TokenTransfer @entity(immutable: true) {
" The concatenation of the transfer transaction hash, the log index and the action index (set to 0). Joined by '_'. "
id: ID!
" The DAO that manages the transfer. "
dao: Dao!
" The amount of transferred native tokens . "
amount: BigInt!
" The Ethereum address from which the native tokens are being transferred. "
from: Bytes!
" The Ethereum address receiving the native tokens. "
to: Bytes!
" The reference describing the deposit reason. "
reference: String!
" The associated DAO proposal, if applicable. Using the DAO `deposit` function there's no need for proposal. "
proposal: IProposal
" The type of transfer (External, Withdraw, Deposit) from the DAO's POV. "
type: TransferType!
" The hash of the native token transfer to track the transaction. "
txHash: Bytes!
" The timestamp of the native token transfer block. "
createdAt: BigInt!
}
#############################
######## Executions #########
#############################
"""
Actions are represented by solidity struct and executed by the DAO's `execute` function, resulting in an external call.
"""
type Action @entity {
" Concatenation of the proposalID and the index of the action. Joined by '_'. "
id: ID!
" The address to call. "
to: Bytes!
" The native token value to be sent with the call. "
value: BigInt!
" The bytes-encoded function selector and calldata for the call. "
data: Bytes!
" The DAO that will `execute` the function. "
dao: Dao!
" The proposal of the DAO containing the action to be executed. "
proposal: IProposal!
" The result obtained from the executed action in `bytes`. "
execResult: Bytes
}
"""
The supported callback functions for ERC standards registered with [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.
"""
type StandardCallback @entity {
" Concatenation of the DAO address and the interfaceID. Joined by '_'. "
id: ID!
" The DAO associated with the supported callback functions. "
dao: Dao!
" The interface identifier, as specified in [ERC-165](https://eips.ethereum.org/EIPS/eip-165) (XOR of all function selectors in the interface). "
interfaceId: Bytes!
" The selector of the registered callback function. "
callbackSelector: Bytes!
" The magic number registered for the function signature. "
magicNumber: Bytes!
}
# DAO
type Dao @entity {
id: ID! # use address as id
subdomain: String
creator: Bytes!
daoURI: String
metadata: String
createdAt: BigInt!
token: ERC20Contract
actions: [Action!]! @derivedFrom(field: "dao")
transfers: [TokenTransfer!]! @derivedFrom(field: "dao")
balances: [TokenBalance!]! @derivedFrom(field: "dao")
permissions: [Permission!]! @derivedFrom(field: "dao")
proposals: [IProposal!]! @derivedFrom(field: "dao")
trustedForwarder: Bytes
signatureValidator: Bytes
standardCallbacks: [StandardCallback!]! @derivedFrom(field: "dao")
plugins: [PluginInstallation!]! @derivedFrom(field: "dao")
}
# ACL
# Cannot be immutable because a permission can be revoked and granted in the same TX.
# This results in an error in the subgraph if the entity is immutable.
# No need to store granted as we can delete permission when revoked
type Permission @entity {
id: ID! # emitting contract Address (DAO or PluginRepo) + permissionId + where + who
where: Bytes!
permissionId: Bytes!
who: Bytes!
actor: Bytes!
condition: Bytes
# The following attributes is used to create
# one-to-many between DAO or PluginRepo to Permission
dao: Dao
pluginRepo: PluginRepo
}
# Plugins
type PluginRepo @entity(immutable: true) {
id: ID! # address
subdomain: String!
releases: [PluginRelease!]! @derivedFrom(field: "pluginRepo")
# Holds all preparations. Also applied ones.
preparations: [PluginPreparation!]! @derivedFrom(field: "pluginRepo")
# Holds all installed and uninstalled installations.
installations: [PluginInstallation!] @derivedFrom(field: "appliedPluginRepo")
permissions: [Permission!]! @derivedFrom(field: "pluginRepo")
}
type PluginSetup @entity(immutable: true) {
id: ID! # contract address
versions: [PluginVersion!]! @derivedFrom(field: "pluginSetup")
}
type PluginRelease @entity {
id: ID! # pluginRepo + release
pluginRepo: PluginRepo!
release: Int!
metadata: String! # release metadata
builds: [PluginVersion!]! @derivedFrom(field: "release")
}
type PluginVersion @entity(immutable: true) {
id: ID! # pluginRepo + release + build
pluginRepo: PluginRepo!
pluginSetup: PluginSetup
release: PluginRelease!
build: Int!
metadata: String! # build metadata
# Holds all preparations. Also applied ones.
preparations: [PluginPreparation!]! @derivedFrom(field: "pluginVersion")
# Holds all installed and uninstalled installations.
installations: [PluginInstallation!] @derivedFrom(field: "appliedVersion")
}
type PluginPermission @entity(immutable: true) {
id: ID! # PluginPreparation + operation + where + who + permissionId
pluginPreparation: PluginPreparation!
operation: PermissionOperation!
where: Bytes!
who: Bytes!
condition: Bytes
permissionId: Bytes!
}
enum PermissionOperation {
Grant
Revoke
GrantWithCondition
}
type PluginPreparation @entity(immutable: true) {
id: ID! # psp setupId + installationId
installation: PluginInstallation!
creator: Bytes!
dao: Dao!
preparedSetupId: Bytes! # the psp setupId
pluginRepo: PluginRepo!
pluginVersion: PluginVersion!
data: Bytes
pluginAddress: Bytes!
helpers: [Bytes!]!
permissions: [PluginPermission!]! @derivedFrom(field: "pluginPreparation")
type: PluginPreparationType!
}
# Don't implement IPlugin. Otherwise it would show up under plugins in the DAO entity
type PluginInstallation @entity {
id: ID! # psp installationId
dao: Dao!
plugin: IPlugin # The plugin address as id provided by the applied preparation
appliedPreparation: PluginPreparation
appliedSetupId: Bytes # The setupId of the application see PSP documentation for more info
appliedVersion: PluginVersion # Stored to track installations in the different plugin versions
appliedPluginRepo: PluginRepo # Stored to track installation in the different plugin repos
preparations: [PluginPreparation!]! @derivedFrom(field: "installation")
state: PluginPreparationState!
}
enum PluginPreparationType {
Installation
Update
Uninstallation
}
enum PluginPreparationState {
InstallationPrepared
Installed
UpdatePrepared
UninstallPrepared
Uninstalled
}
interface IPlugin {
id: ID! # plugin address
dao: Dao!
pluginAddress: Bytes!
installations: [PluginInstallation!]! @derivedFrom(field: "plugin")
# TODO: Uncomment as soon as the plugins have their own subgraph
# appliedPreparation: PluginPreparation
# appliedSetupId: Bytes # The setupId of the application see PSP documentation for more info
# preparations: [PluginPreparation!]! @derivedFrom(field: "plugin")
# state: PluginPreparationState!
}
### Entities below should move to there respective subgraph once plugin is seperated from the Aragon OSx
# Proposal
interface IProposal {
id: ID! # package + proposalId
dao: Dao!
creator: Bytes!
metadata: String
actions: [Action!]! @derivedFrom(field: "proposal")
allowFailureMap: BigInt!
failureMap: BigInt
executed: Boolean!
createdAt: BigInt!
startDate: BigInt!
endDate: BigInt!
executionTxHash: Bytes
}
type TransactionActionsProposal implements IProposal @entity {
id: ID!
dao: Dao!
creator: Bytes!
metadata: String
actions: [Action!]! @derivedFrom(field: "proposal")
allowFailureMap: BigInt!
failureMap: BigInt
executed: Boolean!
createdAt: BigInt!
startDate: BigInt!
endDate: BigInt!
executionTxHash: Bytes
}
# Voting
enum VoteOption {
None
Abstain
Yes
No
}
enum VotingMode {
Standard
EarlyExecution
VoteReplacement
}
# TokenVoting
type TokenVotingPlugin implements IPlugin @entity {
"TODO: attributes should be appended to Plugins once plugin is separated from Aragon OSx"
id: ID!
dao: Dao!
pluginAddress: Bytes!
installations: [PluginInstallation!]! @derivedFrom(field: "plugin")
proposals: [TokenVotingProposal!]! @derivedFrom(field: "plugin")
votingMode: VotingMode
supportThreshold: BigInt
minParticipation: BigInt
minDuration: BigInt
minProposerVotingPower: BigInt
proposalCount: BigInt!
token: Token
members: [TokenVotingMember!]! @derivedFrom(field: "plugin")
}
type TokenVotingMember @entity {
id: ID! # user address + TokenVotingPlugin pluginId.
address: Bytes!
balance: BigInt!
plugin: TokenVotingPlugin!
# delegates
delegatee: TokenVotingMember
votingPower: BigInt
# we assume token owners and/or delegatees are members
delegators: [TokenVotingMember!]! @derivedFrom(field: "delegatee")
}
type TokenVotingVoter @entity {
id: ID! # address
address: String! # address as string to facilitate filtering by address on the UI
proposals: [TokenVotingVote!]! @derivedFrom(field: "voter")
plugin: TokenVotingPlugin!
lastUpdated: BigInt
}
type TokenVotingVote @entity {
"VoterProposal for Many-to-Many"
id: ID! # voter + proposal
voter: TokenVotingVoter!
proposal: TokenVotingProposal!
voteOption: VoteOption!
votingPower: BigInt!
createdAt: BigInt!
voteReplaced: Boolean!
updatedAt: BigInt!
}
type TokenVotingProposal implements IProposal @entity {
id: ID! # package + proposalId
dao: Dao!
actions: [Action!]! @derivedFrom(field: "proposal")
allowFailureMap: BigInt!
failureMap: BigInt
plugin: TokenVotingPlugin!
pluginProposalId: BigInt!
creator: Bytes!
metadata: String
votingMode: VotingMode!
supportThreshold: BigInt!
minVotingPower: BigInt!
snapshotBlock: BigInt!
yes: BigInt
no: BigInt
abstain: BigInt
castedVotingPower: BigInt
totalVotingPower: BigInt!
voters: [TokenVotingVote!]! @derivedFrom(field: "proposal")
open: Boolean!
executed: Boolean!
createdAt: BigInt!
startDate: BigInt!
endDate: BigInt!
creationBlockNumber: BigInt!
approvalReached: Boolean!
isSignaling: Boolean!
earlyExecutable: Boolean
executionDate: BigInt
executionBlockNumber: BigInt
executionTxHash: Bytes
}
# AddresslistVoting
type AddresslistVotingPlugin implements IPlugin @entity {
"TODO: attributes should be appended to Plugin once plugin is seperated from Aragon OSx"
id: ID!
dao: Dao!
pluginAddress: Bytes!
installations: [PluginInstallation!]! @derivedFrom(field: "plugin")
proposals: [AddresslistVotingProposal!]! @derivedFrom(field: "plugin")
votingMode: VotingMode
supportThreshold: BigInt
minParticipation: BigInt
minDuration: BigInt
minProposerVotingPower: BigInt
proposalCount: BigInt
members: [AddresslistVotingVoter!]! @derivedFrom(field: "plugin")
}
type AddresslistVotingVoter @entity {
id: ID! # address
address: String # address as string to facilitate filtering by address on the UI
proposals: [AddresslistVotingVote!]! @derivedFrom(field: "voter")
plugin: AddresslistVotingPlugin!
}
type AddresslistVotingVote @entity {
"VoterProposal for Many-to-Many"
id: ID! # voter + proposal
voter: AddresslistVotingVoter!
proposal: AddresslistVotingProposal!
voteOption: VoteOption!
votingPower: BigInt!
createdAt: BigInt!
voteReplaced: Boolean!
updatedAt: BigInt!
}
type AddresslistVotingProposal implements IProposal @entity {
id: ID! # package + proposalId
dao: Dao!
actions: [Action!]! @derivedFrom(field: "proposal")
allowFailureMap: BigInt!
failureMap: BigInt
plugin: AddresslistVotingPlugin!
pluginProposalId: BigInt!
creator: Bytes!
metadata: String
votingMode: VotingMode!
supportThreshold: BigInt!
minVotingPower: BigInt!
snapshotBlock: BigInt!
abstain: BigInt
yes: BigInt
no: BigInt
castedVotingPower: BigInt
totalVotingPower: BigInt!
voters: [AddresslistVotingVote!]! @derivedFrom(field: "proposal")
open: Boolean!
executed: Boolean!
createdAt: BigInt!
startDate: BigInt!
endDate: BigInt!
creationBlockNumber: BigInt!
approvalReached: Boolean!
isSignaling: Boolean!
earlyExecutable: Boolean
executionDate: BigInt
executionBlockNumber: BigInt
executionTxHash: Bytes
}
# Admin (plugin)
type AdminPlugin implements IPlugin @entity {
"TODO: attributes should be appended to Plugin once plugin is separated from Aragon OSx"
id: ID!
dao: Dao!
pluginAddress: Bytes!
installations: [PluginInstallation!]! @derivedFrom(field: "plugin")
proposals: [AdminProposal!]! @derivedFrom(field: "plugin")
administrators: [AdministratorAdminPlugin!]! @derivedFrom(field: "plugin")
}
type Administrator @entity(immutable: true) {
id: ID! # address
address: String # address as string to facilitate filtering by address on the UI
proposals: [AdminProposal!]! @derivedFrom(field: "administrator")
plugins: [AdministratorAdminPlugin!]! @derivedFrom(field: "administrator")
}
type AdministratorAdminPlugin @entity {
"for Many-to-Many"
id: ID! # Administrator + plugin
administrator: Administrator!
plugin: AdminPlugin!
}
type AdminProposal implements IProposal @entity {
id: ID! # plugin + proposalId
dao: Dao!
creator: Bytes! # Administrator address
metadata: String
actions: [Action!]! @derivedFrom(field: "proposal")
allowFailureMap: BigInt!
failureMap: BigInt
executed: Boolean!
createdAt: BigInt!
startDate: BigInt!
endDate: BigInt!
plugin: AdminPlugin!
pluginProposalId: BigInt!
administrator: Administrator!
executionTxHash: Bytes
}
# Multisig
type MultisigPlugin implements IPlugin @entity {
"TODO: attributes should be appended to Plugin once plugin is seperated from Aragon OSx"
id: ID!
dao: Dao!
pluginAddress: Bytes!
installations: [PluginInstallation!]! @derivedFrom(field: "plugin")
proposalCount: BigInt
proposals: [MultisigProposal!]! @derivedFrom(field: "plugin")
members: [MultisigApprover!]! @derivedFrom(field: "plugin")
# multisig settings
minApprovals: Int
onlyListed: Boolean
}
type MultisigApprover @entity {
id: ID! # plugin_address + member_address
address: String # address as string to facilitate filtering by address on the UI
proposals: [MultisigProposalApprover!]! @derivedFrom(field: "approver")
plugin: MultisigPlugin!
}
type MultisigProposalApprover @entity(immutable: true) {
"ApproverProposal for Many-to-Many"
id: ID! # approver + proposal
approver: MultisigApprover!
proposal: MultisigProposal!
createdAt: BigInt!
}
type MultisigProposal implements IProposal @entity {
id: ID! # plugin + proposalId
dao: Dao!
actions: [Action!]! @derivedFrom(field: "proposal")
allowFailureMap: BigInt!
failureMap: BigInt
plugin: MultisigPlugin!
pluginProposalId: BigInt!
creator: Bytes!
metadata: String
createdAt: BigInt!
startDate: BigInt!
endDate: BigInt!
creationBlockNumber: BigInt!
snapshotBlock: BigInt!
minApprovals: Int!
approvals: Int
approvalReached: Boolean!
isSignaling: Boolean!
executed: Boolean!
executionDate: BigInt
executionBlockNumber: BigInt
executionTxHash: Bytes
approvers: [MultisigProposalApprover!]! @derivedFrom(field: "proposal")
}