-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathschema.graphql
266 lines (245 loc) · 5.77 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
type GlobalState @entity {
"constant 0"
id: ID!
height: Int!
totalValue: BigDecimal!
averageBlockTimeUpdatedHeight: Int!
averageBlockTimeUpdatedTime: DateTime!
snapshotUpdatedTime: DateTime!
averageBlockTime: Int!
averageAprMultiplier: BigDecimal!
averageApr: BigDecimal!
"for apr calculation"
idleWorkerShares: BigDecimal!
cumulativeRewards: BigDecimal!
phaRate: BigDecimal!
budgetPerBlock: BigDecimal!
tokenomicUpdatedTime: DateTime!
vMax: BigDecimal!
treasuryRatio: BigDecimal!
re: BigDecimal!
k: BigDecimal!
workerCount: Int!
idleWorkerCount: Int!
budgetPerShare: BigDecimal!
delegatorCount: Int!
idleWorkerPInit: Int!
idleWorkerPInstant: Int!
withdrawalDustCleared: Boolean
}
enum IdentityJudgement {
Unknown
FeePaid
Reasonable
KnownGood
OutOfDate
LowQuality
Erroneous
}
type Account @entity {
"account address"
id: ID!
basePool: BasePool @derivedFrom(field: "account")
identityDisplay: String @index
identityLevel: IdentityJudgement
identityJudgements: [IdentityJudgement!]
stakePoolValue: BigDecimal!
stakePoolNftCount: Int!
stakePoolAvgAprMultiplier: BigDecimal!
vaultValue: BigDecimal!
vaultNftCount: Int!
vaultAvgAprMultiplier: BigDecimal!
ownedPools: [BasePool!] @derivedFrom(field: "owner")
cumulativeStakePoolOwnerRewards: BigDecimal!
cumulativeVaultOwnerRewards: BigDecimal!
}
enum BasePoolKind {
Vault
StakePool
}
type BasePool @entity {
"pid"
id: ID!
"numeric pid for sorting"
pid: BigInt! @index
"NFT collection id"
cid: Int!
owner: Account!
account: Account! @unique
kind: BasePoolKind! @index
"decimal percentage, 1 means 100%"
commission: BigDecimal!
vault: Vault @derivedFrom(field: "basePool")
stakePool: StakePool @derivedFrom(field: "basePool")
aprMultiplier: BigDecimal! @index
totalShares: BigDecimal!
totalValue: BigDecimal! @index
sharePrice: BigDecimal!
freeValue: BigDecimal!
releasingValue: BigDecimal!
withdrawingValue: BigDecimal!
withdrawingShares: BigDecimal!
delegatorCount: Int!
whitelistEnabled: Boolean! @index
whitelists: [BasePoolWhitelist!] @derivedFrom(field: "basePool")
delegations: [Delegation!] @derivedFrom(field: "basePool")
cumulativeOwnerRewards: BigDecimal!
}
type Vault @entity {
"pid"
id: ID!
basePool: BasePool! @unique
"share price of owner's last gain"
lastSharePriceCheckpoint: BigDecimal!
claimableOwnerShares: BigDecimal!
}
type StakePool @entity {
"pid"
id: ID!
basePool: BasePool! @unique
"null means infinite"
capacity: BigDecimal
"null means infinite"
delegable: BigDecimal
ownerReward: BigDecimal!
workerCount: Int!
idleWorkerCount: Int!
idleWorkerShares: BigDecimal!
workers: [Worker!]! @derivedFrom(field: "stakePool")
}
type Delegation @entity @index(fields: ["basePool", "account"], unique: true) {
"${pid}-${accountId}"
id: ID!
account: Account!
basePool: BasePool!
value: BigDecimal!
cost: BigDecimal!
shares: BigDecimal!
withdrawingValue: BigDecimal!
withdrawingShares: BigDecimal!
withdrawalStartTime: DateTime
delegationNft: Nft @unique
withdrawalNft: Nft @unique
}
type Nft @entity @index(fields: ["cid", "nftId"], unique: true) {
"${cid}-${nftId}"
id: ID!
owner: Account!
cid: Int!
nftId: Int!
mintTime: DateTime
delegation: Delegation @derivedFrom(field: "delegationNft")
}
type BasePoolWhitelist @entity @index(fields: ["basePool", "createTime"]) {
"${pid}-${accountId}"
id: ID!
account: Account!
basePool: BasePool!
createTime: DateTime!
}
type Worker @entity {
"worker public key"
id: ID!
stakePool: StakePool
session: Session @derivedFrom(field: "worker")
confidenceLevel: Int!
initialScore: Int
}
enum WorkerState {
Ready
WorkerIdle
WorkerUnresponsive
WorkerCoolingDown
}
type Session @entity {
"session account address"
id: ID!
worker: Worker @unique
stake: BigDecimal!
state: WorkerState!
v: BigDecimal!
ve: BigDecimal!
pInit: Int!
pInstant: Int!
totalReward: BigDecimal!
coolingDownStartTime: DateTime
shares: BigDecimal!
}
type AccountSnapshot
@entity
@index(fields: ["account", "updatedTime"], unique: true) {
id: ID!
"block time"
updatedTime: DateTime!
account: String!
delegationValue: BigDecimal!
cumulativeStakePoolOwnerRewards: BigDecimal!
cumulativeVaultOwnerRewards: BigDecimal!
}
type BasePoolSnapshot
@entity
@index(fields: ["basePool", "updatedTime"], unique: true) {
id: ID!
"block time"
updatedTime: DateTime!
basePool: String!
commission: BigDecimal!
apr: BigDecimal!
totalShares: BigDecimal!
totalValue: BigDecimal!
sharePrice: BigDecimal!
freeValue: BigDecimal!
releasingValue: BigDecimal!
withdrawingValue: BigDecimal!
withdrawingShares: BigDecimal!
delegatorCount: Int!
workerCount: Int
idleWorkerCount: Int
stakePoolCount: Int
cumulativeOwnerRewards: BigDecimal!
}
type GlobalStateSnapshot @entity {
id: ID!
"block time"
height: Int! @index
updatedTime: DateTime! @index
totalValue: BigDecimal!
averageBlockTime: Int!
averageApr: BigDecimal!
idleWorkerShares: BigDecimal!
cumulativeRewards: BigDecimal!
budgetPerBlock: BigDecimal!
workerCount: Int!
idleWorkerCount: Int!
budgetPerShare: BigDecimal!
delegatorCount: Int!
}
type DelegationSnapshot
@entity
@index(fields: ["delegation", "updatedTime"], unique: true) {
id: ID!
"block time"
updatedTime: DateTime!
delegation: String!
cost: BigDecimal!
value: BigDecimal!
}
type WorkerSnapshot
@entity
@index(fields: ["worker", "updatedTime"], unique: true) {
id: ID!
"block time"
updatedTime: DateTime!
worker: String!
stakePool: String!
session: String!
confidenceLevel: Int!
initialScore: Int
stake: BigDecimal!
state: WorkerState!
v: BigDecimal!
ve: BigDecimal!
pInit: Int!
pInstant: Int!
totalReward: BigDecimal!
}