-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.graphql
286 lines (248 loc) · 5.78 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
#################################################
# Interfaces
#################################################
interface IEvent {
id: ID! # transactionHash-logId
timestamp: BigInt!
}
interface IContract {
id: ID! # Contract address
createdAt: BigInt!
}
#################################################
# Current-state entities
#################################################
type User @entity {
id: ID! # deafult opolis wallet address
defaultWallet: Wallet!
preferredWallet: Wallet!
wallets: [Wallet!] @derivedFrom(field: "user")
isEmployee: Boolean!
isWhitelisted: Boolean!
totalStakedBalance: BigDecimal!
totalRewardClaimed: BigDecimal!
createdAt: BigInt!
}
type Wallet @entity {
id: ID! # wallet address
user: User!
createdAt: BigInt!
}
type Token @entity {
id: ID! # token address
name: String!
symbol: String!
decimals: Int!
totalSupply: BigInt!
}
type Payroll @entity {
id: ID! # payrollId
payrollId: BigInt!
payor: Bytes! # address of the payor
token: Token!
amount: BigDecimal!
createdAt: BigInt!
txHash: Bytes!
withdrawnAt: BigInt
contract: OpolisPayContract!
}
type Stake @entity {
id: ID! # memberId (stakeId)
memberId: BigInt!
staker: Bytes! # address of the payor
token: Token!
amount: BigDecimal!
stakeNumber: BigInt!
createdAt: BigInt!
txHash: Bytes!
withdrawnAt: BigInt
contract: OpolisPayContract!
}
type OpolisPayToken @entity {
id: ID! # opolisPayId-tokenId
token: Token!
liqDestination: Bytes
opolisPayContract: OpolisPayContract!
createdAt: BigInt!
}
type OpolisPayContract implements IContract @entity {
id: ID! # Contract address
opolisAdmin: Bytes!
opolisHelper: Bytes!
destination: Bytes!
supportedTokens: [OpolisPayToken!]! @derivedFrom(field: "opolisPayContract")
liqDestinations: [Bytes!]
createdAt: BigInt!
version: Int!
}
type StakingContract implements IContract @entity {
id: ID!
owner: Bytes!
isPaused: Boolean!
stakeToken: Token!
minStake: BigDecimal!
totalStake: BigDecimal!
description: String!
createdAt: BigInt!
}
type WhitelistContract implements IContract @entity {
id: ID!
owner: Bytes!
totalUsers: BigInt!
totalWhitelistedUsers: BigInt!
totalWhitelistedEmployees: BigInt!
totalEmployeeUsers: BigInt!
totalCoalitionUsers: BigInt!
createdAt: BigInt!
}
type MerkleRedeemContract implements IContract @entity {
id: ID!
owner: Bytes!
rewardToken: Token!
totalRewardCycles: BigInt!
totalTokenAllocation: BigDecimal!
createdAt: BigInt!
}
#################################################
# Historical event entities
#################################################
#### Whitelist Contract Events ####
type AddedToWhitelistEvent implements IEvent @entity {
id: ID!
user: User!
isEmployee: Boolean!
timestamp: BigInt!
}
type UpdatedWhitelistAddressEvent implements IEvent @entity {
id: ID!
user: User!
oldWallet: Wallet!
updatedWallet: Wallet!
timestamp: BigInt!
}
type RemovedFromWhitelistEvent implements IEvent @entity {
id: ID!
user: User!
timestamp: BigInt!
}
#### Staking Contract Events ####
type StakeEvent implements IEvent @entity {
id: ID!
user: User!
wallet: Wallet!
amount: BigDecimal!
totalStaked: BigDecimal!
timestamp: BigInt!
}
type UnstakeEvent implements IEvent @entity {
id: ID!
user: User!
wallet: Wallet!
amount: BigDecimal!
totalStaked: BigDecimal!
timestamp: BigInt!
}
#### MerkleRedeem Contract Events ####
type RootAddedEvent implements IEvent @entity {
id: ID!
rewardEpoch: BigInt!
totalAllocation: BigDecimal!
depositor: Bytes!
timestamp: BigInt!
}
type ClaimedEvent implements IEvent @entity {
id: ID!
rewardEpoch: BigInt!
wallet: Wallet!
claimedBalance: BigDecimal!
timestamp: BigInt!
}
#### OpolisPay Contract Events ####
type SetupCompleteEvent implements IEvent @entity {
id: ID!
destination: Bytes! # address of the destination Wire account
admin: Bytes! # address of the admin account
helper: Bytes! # address of the helper account
supportedTokens: [Bytes!]!
timestamp: BigInt!
}
type StakedEvent implements IEvent @entity {
id: ID!
staker: Bytes! # address of the staker
token: Token!
amount: BigDecimal!
memberId: BigInt!
stakeNumber: BigInt!
timestamp: BigInt!
}
type PaidEvent implements IEvent @entity {
id: ID!
payrollId: BigInt!
payor: Bytes!
token: Token!
amount: BigDecimal!
timestamp: BigInt!
}
type OpsPayrollWithdrawEvent implements IEvent @entity {
id: ID!
payrollId: BigInt!
token: Token!
amount: BigDecimal!
timestamp: BigInt!
}
type OpsStakeWithdrawEvent implements IEvent @entity {
id: ID!
stakeId: BigInt!
token: Token!
amount: BigDecimal!
stakeNumber: BigInt!
timestamp: BigInt!
}
type SweepEvent implements IEvent @entity {
id: ID!
sweeper: Bytes!
token: Token!
amount: BigDecimal!
timestamp: BigInt!
}
type NewDestinationEvent implements IEvent @entity {
id: ID!
oldDestination: Bytes!
destination: Bytes!
timestamp: BigInt!
}
type NewAdminEvent implements IEvent @entity {
id: ID!
oldAdmin: Bytes!
opolisAdmin: Bytes!
timestamp: BigInt!
}
type NewHelperEvent implements IEvent @entity {
id: ID!
oldHelper: Bytes!
newHelper: Bytes!
timestamp: BigInt!
}
type NewTokensEvent implements IEvent @entity {
id: ID!
newTokens: [Bytes!]!
newDestinations: [Bytes!]
timestamp: BigInt!
}
### OpolisPay ContractV3 Events
type SetupCompleteEventV3 implements IEvent @entity {
id: ID!
admin: Bytes! # address of the admin account
helper: Bytes! # address of the helper account
ethLiquidation: Bytes! # address of the destination for eth
supportedTokens: [Bytes!]!
liqDestinations: [Bytes!]!
timestamp: BigInt!
}
type NewDestinationEventV3 implements IEvent @entity {
id: ID!
token: Token!
oldDestination: Bytes!
destination: Bytes!
timestamp: BigInt!
}