-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathschema.graphql
193 lines (185 loc) · 5.25 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
"""
Projects are the member type which the Everest list is curated for
"""
type Project @entity {
"Required ID"
id: ID!
# From IPFS / off chain storage
# None of these are required, since first the event DIDOwnerChanged creates the project
# Then DIDAttributeChanged gets emitted, where we will see theses values filled in
"The IPFS hash where all off-chain data is stored"
ipfsHash: String
"Project name"
name: String
"Project description"
description: String
"Project website"
website: String
"Project twitter handle"
twitter: String
"Project github URL"
github: String
"Project avatar"
avatar: String
"Project image"
image: String
"List of project categories"
categories: [Category!]!
"True if a representative of the company owns this project"
isRepresentative: Boolean!
"Time it was created at on the blockchain"
createdAt: Int!
"Time it was updated at on the blockchain"
updatedAt: Int!
# From smart contracts directly
"Owner of this project"
owner: User
"Current challenge against this project"
currentChallenge: Challenge
"Past challenges agaisnt this project"
pastChallenges: [Challenge!]
"Challenges this project has created against other projects"
createdChallenges: [Challenge!]
"Time this project joined Everest"
membershipStartTime: Int! # reputation = now - membershipStartTime.
"List of all delegates of this project"
delegates: [User!]
"Total vote count"
totalVotes: Int!
"All votes a project has made"
votes: [Vote!] @derivedFrom(field: "voter")
}
"""
Project Categories
"""
type Category @entity {
"The ID is a lowercased name"
id: ID!
"The category description"
description: String!
"The IPFS hash of the category image"
imageHash: String!
"The Url of the category image"
imageUrl: String!
"The name of the category, case insensitive"
name: String!
"The name used for the front end"
slug: String!
"Projects with this category designation"
projects: [Project!]!
"The subcategories of this Category"
subcategories: [Category!] @derivedFrom(field: "parentCategory")
"Parent category of this category. Null if it is a top level category"
parentCategory: Category
"Time it was created in the Subgraph"
createdAt: Int!
"Number of projects in this category and all of its subcategories"
projectCount: Int!
}
type Challenge @entity {
"Challenge ID"
id: ID!
"IPFS hash where the description is stored"
ipfsHash: String!
"Challenge description"
description: String
"End time of the challenge"
endTime: Int!
"Votes yes to a challenge for removal of the project (in weight)"
removeVotes: Int!
"Voting no to a challenge for keeping the project (in weight)"
keepVotes: Int!
"Project that is being challenged"
project: Project # Can be null since projects get deleted upon challenge
"Owner of the challenge, which is a project"
owner: Project # Can be null since projects get deleted upon challenge
"List of all created votes"
votes: [Vote!] @derivedFrom(field: "challenge")
# This is when the challenge is resolved, which is different from end time
"True if the challenge has been resolved"
resolved: Boolean!
"Time challenge was created on the blockchain"
createdAt: Int!
}
"""
Everest holds the global variables relevant to the dapp
"""
type Everest @entity {
id: ID!
"Owner of the Everest contract"
owner: Bytes!
"Approved token for Everest fees"
approvedToken: Bytes!
"Voting period for challenges"
votingPeriodDuration: Int!
"Challege deposit in DAI"
challengeDeposit: BigInt!
"Fee to apply to be in Everest"
applicationFee: BigInt!
"Address of everest"
everestAddress: Bytes!
"Address of the reserve bank"
reserveBankAddress: Bytes!
"Balance of the reserve bank (DAI)"
reserveBankBalance: BigInt!
"IPFS hash pointing to the categories"
categories: Bytes!
"IPFS hash pointing to the charter"
charter: Bytes!
"Time it was created on the blockchain"
createdAt: Int!
"Total count of projects created on Everest"
projectCount: Int!
"Projects that are currently in control by a representative"
claimedProjects: Int!
"Projects that are currently under challenge"
challengedProjects: Int!
"The amount of categories in Everest"
categoriesCount: Int!
}
"""
A challenge vote
"""
type Vote @entity {
"Concatenation of challenge ID and voter address"
id: ID!
"Project that voted on the challenge"
voter: Project
"Challenge the vote is for"
challenge: Challenge!
"Vote choice"
choice: Choice!
"Vote weight based on project reputation"
weight: Int!
"Time that vote was created on the blockchain"
createdAt: Int!
}
"""
The Vote choice enum
"""
enum Choice {
Null
Yes
No
}
"""
A User of the Everest Dapp. A User is the owner or delegate of Projects. User info
is obtained from 3box
"""
type User @entity {
"User ethereum address"
id: ID!
"Projects the user owns"
projects: [Project!] @derivedFrom(field: "owner")
"Projects the user is a delegate of"
delegatorProjects: [Project!] @derivedFrom(field: "delegates")
"The time the user was created in the Subgraph (not the blockchain)"
createdAt: Int!
}
type _Schema_
@fulltext(
name: "projectSearch"
language: en
algorithm: rank
include: [{ entity: "Project", fields: [{ name: "name" }, { name: "description" }] }]
)