-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathschema.graphql
153 lines (123 loc) · 3.02 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
type Condition @entity {
id: ID!
conditionId: String!
oracle: String!
questionId: String!
outcomeSlotCount: Int!
creator: String!
createTransaction: Bytes!
createTimestamp: BigInt!
createBlockNumber: BigInt!
resolved: Boolean!
resolveTransaction: Bytes
resolveTimestamp: BigInt
resolveBlockNumber: BigInt
payoutNumerators: [BigInt!]
payoutDenominator: BigInt
payouts: [BigDecimal!]
question: Question
title: String
outcomes: [String!]
scalarLow: BigInt
scalarHigh: BigInt
collections: [Collection!] @derivedFrom(field: "conditions")
positions: [Position!] @derivedFrom(field: "conditions")
}
type Collection @entity {
id: ID!
# conditions is duplicated as conditionIds
# so that when querying the graph node,
# the graph does not attempt to join with the other table
# which would cause conditions to be returned
# sorted by ID, instead of in the same order as
# the raw field data.
conditions: [Condition!]!
conditionIds: [ID!]!
conditionIdsStr: String!
indexSets: [BigInt!]!
multiplicities: [Int!]!
positions: [Position!] @derivedFrom(field: "collection")
}
type Position @entity {
id: ID!
positionId: String!
collateralToken: CollateralToken!
collateralTokenAddress: String!
collection: Collection!
# see note above about conditions/conditionIds duplication
conditions: [Condition!]!
conditionIds: [ID!]!
conditionIdsStr: String!
indexSets: [BigInt!]!
multiplicities: [Int!]!
createTimestamp: BigInt!
lifetimeValue: BigInt!
activeValue: BigInt!
wrappedTokens: [WrappedToken!]! @derivedFrom(field: "position")
wrappedTokenAddress: String
}
type UserPosition @entity {
id: ID!
position: Position!
balance: BigInt!
wrappedBalance: BigInt!
totalBalance: BigInt!
user: User!
}
type User @entity {
id: ID!
firstParticipation: BigInt!
lastActive: BigInt!
userPositions: [UserPosition!] @derivedFrom(field: "user")
}
type CollateralToken @entity {
id: ID!
activeAmount: BigInt!
splitAmount: BigInt!
mergedAmount: BigInt!
redeemedAmount: BigInt!
positions: [Position!] @derivedFrom(field: "collateralToken")
}
type WrappedToken @entity {
id: ID!
position: Position!
}
type Question @entity {
id: ID!
templateId: BigInt!
data: String!
title: String
outcomes: [String!]
category: String
language: String
arbitrator: String!
openingTimestamp: BigInt!
timeout: BigInt!
currentAnswer: Bytes
currentAnswerBond: BigInt
currentAnswerTimestamp: BigInt
isPendingArbitration: Boolean!
arbitrationOccurred: Boolean!
answerFinalizedTimestamp: BigInt
conditions: [Condition!]! @derivedFrom(field: "question")
}
type Category @entity {
id: ID!
numConditions: Int!
numOpenConditions: Int!
numClosedConditions: Int!
}
type ScalarQuestionLink @entity {
id: ID!
conditionQuestionId: Bytes!
realityEthQuestionId: Bytes!
question: Question
scalarLow: BigInt!
scalarHigh: BigInt!
}
type Global @entity {
id: ID! # empty string
numConditions: Int!
numCollections: Int!
numPositions: Int!
}