-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
489 lines (451 loc) · 18 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
type OffchainAssetReceiptVaultFactory @entity {
id: ID! #factory address
"Address of the OffchainAssetReceiptVault contract"
address: Bytes! #factory address
implementation: Bytes #implementation address from Implementation event
"Stake addresses deployed by this factory"
children: [OffchainAssetReceiptVault!] @derivedFrom(field: "factory") #all the children that were deployed by this factory
childrenCount: BigInt!
}
type OffchainAssetReceiptVault @entity {
"The contract address"
id: ID! #OffchainAssetReceiptVault contract address
"Address of this OffchainAssetReceiptVault contract"
address: Bytes! #OffchainAssetReceiptVault contract address
"Address of this OffchainAssetReceiptVault receipt contract"
receiptContractAddress: Bytes #OffchainAssetReceiptVault receipt contract address
"Block number of contract deployment"
deployBlock: BigInt! #the block the contract was deployed
"Timestamp of contract deployment"
deployTimestamp: BigInt! #the timestamp the contract was deployed
"Address of deployer"
deployer: Bytes! #address of the deployer - get from event OffchainAssetVaultConstruction.sender
"Address of the OffchainAssetReceiptVaultFactory that is this contract's parent."
factory: OffchainAssetReceiptVaultFactory! # The factory that deployed this contract
"The initial admin set when this contract was deployed"
admin: Bytes! # OffchainAssetVaultConstruction.sender
"The name of the ERC20 token for this OffchainAssetReceiptVault"
name: String! # OffchainAssetVaultConstruction.receiptVaultConfig.name
"The symbol for the ERC20 token for this OffchainAssetReceiptVault"
symbol: String! # OffchainAssetVaultConstruction.receiptVaultConfig.symbol
"This OffchainAssetReceiptVault as an account including its associated events"
asAccount: Account
"The total number of shares for this OffchainAssetReceiptVault"
totalShares: BigInt! # OffchainAssetReceiptVault.totalSupply() - update with every mint/burn
"Share holders for this OffchainAssetReceiptVault"
shareHolders: [Account!] # All Accounts that have a ShareBalance for this OffchainAssetReceiptVault
"Number of share holders for this OffchainAssetReceiptVault"
shareHoldersCount: BigInt! # Number of All Accounts that have a ShareBalance for this OffchainAssetReceiptVault
"Share balances for this OffchainAssetReceiptVault"
shareBalances: [SharesBalance!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Share approvals for this OffchainAssetReceiptVault"
shareApprovals: [SharesApproval!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Share transfers for this OffchainAssetReceiptVault"
shareTransfers: [SharesTransfer!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Receipt holders for this OffchainAssetReceiptVault"
receiptHolders: [Account!] # All Accounts that have a ReceiptBalance for an ID for this OffchainAssetReceiptVault
"Receipts for this OffchainAssetReceiptVault"
receipts: [Receipt!]! @derivedFrom(field: "offchainAssetReceiptVault")
"Receipt balances for this OffchainAssetReceiptVault"
receiptBalances: [ReceiptBalance!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Receipt operators for this OffchainAssetReceiptVault"
receiptOperators: [ReceiptOperator!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Receipt transfers for this OffchainAssetReceiptVault"
receiptTransfers: [ReceiptTransfer!]
@derivedFrom(field: "offchainAssetReceiptVault")
receiptVaultInformations: [ReceiptVaultInformation!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Deposits for this OffchainAssetReceiptVault"
deposits: [DepositWithReceipt!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Withdraws for this OffchainAssetReceiptVault"
withdraws: [WithdrawWithReceipt!]
@derivedFrom(field: "offchainAssetReceiptVault")
"The timestamp that this OffchainAssetReceiptVault is certified until"
certifiedUntil: BigInt! # Updated with each new Certify event
"Certifications for this OffchainAssetReceiptVault"
certifications: [Certify!] @derivedFrom(field: "offchainAssetReceiptVault")
"Share confiscations"
shareConfiscations: [ConfiscateShares!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Receipt confiscations"
receiptConfiscations: [ConfiscateReceipt!]
@derivedFrom(field: "offchainAssetReceiptVault")
"Role holders"
roleHolders: [RoleHolder!] @derivedFrom(field: "offchainAssetReceiptVault")
"Roles"
roles: [Role!] @derivedFrom(field: "offchainAssetReceiptVault")
"Role revoke events"
roleRevokes: [RoleRevoked!] @derivedFrom(field: "offchainAssetReceiptVault")
"Role granted events"
rolesGranted: [RoleGranted!] @derivedFrom(field: "offchainAssetReceiptVault")
hashes: [Hash!] @derivedFrom(field: "offchainAssetReceiptVault")
hashCount: BigInt!
"Token holders"
tokenHolders: [TokenHolder!] @derivedFrom(field: "offchainAssetReceiptVault")
}
type Account @entity {
id: ID!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
address: Bytes!
shareBalances: [SharesBalance!]! @derivedFrom(field: "account")
shareApprovalsOwner: [SharesApproval!]! @derivedFrom(field: "owner")
shareApprovalsSpender: [SharesApproval!]! @derivedFrom(field: "spender")
shareTransferFromEvent: [SharesTransfer!]! @derivedFrom(field: "from")
shareTransferToEvent: [SharesTransfer!]! @derivedFrom(field: "to")
receiptBalances: [ReceiptBalance!]! @derivedFrom(field: "account")
receiptOperatorOwner: [ReceiptOperator!]! @derivedFrom(field: "owner")
receiptOperatorOperator: [ReceiptOperator!]! @derivedFrom(field: "operator")
receiptTransferFromEvent: [ReceiptTransfer!]! @derivedFrom(field: "from")
receiptTransferToEvent: [ReceiptTransfer!]! @derivedFrom(field: "to")
receiptTransferOperatorEvent: [ReceiptTransfer!]!
@derivedFrom(field: "operator")
depositWithReceipts: [DepositWithReceipt!] @derivedFrom(field: "caller")
withdrawWithReceipts: [WithdrawWithReceipt!] @derivedFrom(field: "caller")
conficateSharesConfiscator: [ConfiscateShares!]!
@derivedFrom(field: "confiscator")
conficateSharesConfiscatee: [ConfiscateShares!]!
@derivedFrom(field: "confiscatee")
conficateReceiptConfiscator: [ConfiscateShares!]!
@derivedFrom(field: "confiscator")
conficateReceiptConfiscatee: [ConfiscateShares!]!
@derivedFrom(field: "confiscatee")
certifies: [Certify!]! @derivedFrom(field: "certifier")
roleHolders: [RoleHolder!]! @derivedFrom(field: "account")
rolesRevoked: [RoleRevoked!] @derivedFrom(field: "account")
rolesGranted: [RoleGranted!] @derivedFrom(field: "account")
events: [Event!]! @derivedFrom(field: "emitter")
hashes: [Hash!]! @derivedFrom(field: "owner")
hashCount: BigInt!
}
# Created with every DepositWithReceipt
# Subsequent DepositWithReceipt and WithdrawWithReceipt events update shares
# Receipt information added via the ReceiptInformation event (see below)
type Receipt @entity {
"ID"
id: ID! # {OffchainAssetReceiptVault address}-{DepositWithReceipt.id}
"ID of the receipt"
receiptId: BigInt! # From DepositWithReceipt.id
"The OffchainAssetReceiptVault that this receipt is for"
offchainAssetReceiptVault: OffchainAssetReceiptVault!
"Total shares created for this receipt"
shares: BigInt! # INCREASES with every DepositWithReceipt and DECREASES with every WithdrawWithReceipt
"Deposits for this receipt"
deposits: [DepositWithReceipt!] @derivedFrom(field: "receipt")
"Withdraws for this receipt"
withdraws: [WithdrawWithReceipt!] @derivedFrom(field: "receipt")
"Holders of this receipt"
holders: [Account!] # All Accounts that have a ReceiptBalance for this receiptId
"Balances for this receipt"
balances: [ReceiptBalance!] @derivedFrom(field: "receipt")
"Transfers for this receipt"
transfers: [ReceiptTransfer!] @derivedFrom(field: "token")
"Information for this receipt"
receiptInformations: [ReceiptInformation!] @derivedFrom(field: "receipt")
}
# Created with every DepositWithReceipt event
type DepositWithReceipt implements Event @entity {
id: ID!
"The transaction in which DepositWithReceipt was emitted"
transaction: Transaction!
"The emitter of the event"
emitter: Account!
"Timestamp for DepositWithReceipt event"
timestamp: BigInt! # the timestamp of the DepositWithReceipt event
"The OffchainAssetReceiptVault that this deposit is for"
offchainAssetReceiptVault: OffchainAssetReceiptVault! # OffchainAssetReceiptVault that emitted the mint event
"The receipt this deposit is for"
receipt: Receipt! # DepositWithReceipt.id
"The amount of shares and receipts minted with this deposit"
amount: BigInt! # DepositWithReceipt.shares
# "The receipt information submitted with the deposit"
# information: ReceiptInformation! @derivedFrom(field: "receipt")
"The receiver of the ERC1155 receipts and the ERC20 shares"
receiver: Account! # From DepositWithReceipt.receiver
"The caller of the transaction"
caller: Account! # DepositWithReceipt.caller
"data"
data: String!
"erc1155TokenId"
erc1155TokenId: String!
}
# Created with every WithdrawWithReceipt event
type WithdrawWithReceipt implements Event @entity {
id: ID!
"The transaction in which WithdrawWithReceipt was emitted"
transaction: Transaction!
"The emitter of the event"
emitter: Account!
"Timestamp for WithdrawWithReceipt event"
timestamp: BigInt! # the timestamp of the WithdrawWithReceipt event
"The OffchainAssetReceiptVault that this withdraw is for"
offchainAssetReceiptVault: OffchainAssetReceiptVault! # OffchainAssetReceiptVault that emitted the mint event
"The receipt this withdraw is for"
receipt: Receipt! # WithdrawWithReceipt.id
"The amount of shares and receipts burned with this withdraw"
amount: BigInt! # WithdrawWithReceipt.shares
"The owner of the ERC1155 receipts and the ERC20 shares burned"
owner: Account! # From WithdrawWithReceipt.owner
"The caller of the transaction"
caller: Account! # WithdrawWithReceipt.caller
"data"
data: String!
"erc1155TokenId"
erc1155TokenId: String!
}
# Created with every new ReceiptInformation event
type ReceiptInformation implements Event @entity {
id: ID!
"The transaction in which ReceiptInformation was emitted"
transaction: Transaction!
"The emitter of the event"
emitter: Account!
"Timestamp for ReceiptInformation event"
timestamp: BigInt! # the timestamp of the ReceiptInformation event
"The OffchainAssetReceiptVault that has the receipt this information is for"
offchainAssetReceiptVault: OffchainAssetReceiptVault! # OffchainAssetReceiptVault that emitted ths Certify event
"The receipt this information is for"
receipt: Receipt # Link by {OffchainAssetReceiptVault address}-{TransferSingle.id}
"The information"
information: Bytes! # ReceiptInformation.data
"The caller of this receipt information"
caller: Account! # ReceiptInformation.caller
payload : String
magicNumber: BigInt
contentType: String
contentEncoding: String
contentLanguage: String
schema: String
}
# Created with every new ReceiptVaultInformation event
type ReceiptVaultInformation implements Event @entity {
id: ID!
"The transaction in which ReceiptInformation was emitted"
transaction: Transaction!
"The emitter of the event"
emitter: Account!
"Timestamp for ReceiptInformation event"
timestamp: BigInt! # the timestamp of the ReceiptInformation event
"The OffchainAssetReceiptVault that has the receipt this information is for"
offchainAssetReceiptVault: OffchainAssetReceiptVault! # OffchainAssetReceiptVault that emitted ths Certify event
"The information"
information: Bytes! # ReceiptInformation.data
"The caller of this receipt information"
caller: Account! # ReceiptInformation.caller
payload : String
magicNumber: BigInt
contentType: String
contentEncoding: String
contentLanguage: String
}
# Get from event Certify
type Certify implements Event @entity {
id: ID!
"The transaction in which Certify was emitted"
transaction: Transaction!
"The emitter of the event"
emitter: Account!
"Timestamp for Certify event"
timestamp: BigInt! # the timestamp of the Certify event
"The OffchainAssetReceiptVault that this certification is for"
offchainAssetReceiptVault: OffchainAssetReceiptVault! # OffchainAssetReceiptVault that emitted ths Certify event
"The address that submitted the certification."
certifier: Account! # Certify.sender
"Until when the certification is valid."
certifiedUntil: BigInt! # Certify.until
"The data submitted with the certification"
data: String! # Certify.data
"Total shares of offchainAssetReceiptVault while certify"
totalShares: BigInt! # OffchainAssetReceiptVault.totalSupply()
"The information"
information: Bytes! # Certify.data
}
# Get from event ConfiscateShares
type ConfiscateShares implements Event @entity {
id: ID!
"The transaction in which ConfiscateShares was emitted"
transaction: Transaction!
"The emitter of the event"
emitter: Account!
"Timestamp for ConfiscateShares event"
timestamp: BigInt! # the timestamp of the ConfiscateShares event
"The OffchainAssetReceiptVault that shares were confiscated for"
offchainAssetReceiptVault: OffchainAssetReceiptVault! # OffchainAssetReceiptVault that emitted the event
"The confiscator's address"
confiscator: Account! # ConfiscateShares.sender
"The confiscatee's address"
confiscatee: Account! # ConfiscateShares.confiscatee
"The number of shares confiscated"
confiscated: BigInt! # ConfiscateShares.confiscated
"data"
data: String!
}
# Get from event ConfiscateReceipt
type ConfiscateReceipt implements Event @entity {
id: ID!
"The transaction in which ConfiscateReceipt was emitted"
transaction: Transaction!
"The emitter of the event"
emitter: Account!
"Timestamp for ConfiscateReceipt event"
timestamp: BigInt! # the timestamp of the ConfiscateReceipt event
"The OffchainAssetReceiptVault that shares were confiscated for"
offchainAssetReceiptVault: OffchainAssetReceiptVault! # OffchainAssetReceiptVault that emitted the event
"The confiscator's address"
confiscator: Account! # ConfiscateReceipt.sender
"The confiscatee's address"
confiscatee: Account! # ConfiscateReceipt.confiscatee
"The receipt confiscated"
receipt: Receipt! # Link to Receipt for {OffchainAssetReceiptVault address}-{Confiscate.id}
"The number of receipts confiscated"
confiscated: BigInt! # ConfiscateReceipt.confiscated
"data"
data: String!
}
type SharesBalance @entity {
id: ID!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
account: Account
value: BigDecimal!
valueExact: BigInt!
transferFromEvents: [SharesTransfer!]! @derivedFrom(field: "fromBalance")
transferToEvents: [SharesTransfer!]! @derivedFrom(field: "toBalance")
"The amount of shares that have been confiscated for this account."
confiscated: BigInt! # Update if there is a ConfiscateShares for this OffchainAssetReceiptVault and Account
}
type SharesApproval implements Event @entity {
id: ID!
emitter: Account!
transaction: Transaction!
timestamp: BigInt!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
owner: Account!
spender: Account!
value: BigDecimal!
valueExact: BigInt!
}
type SharesTransfer implements Event @entity {
id: ID!
emitter: Account!
transaction: Transaction!
timestamp: BigInt!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
from: Account
fromBalance: SharesBalance
to: Account
toBalance: SharesBalance
value: BigDecimal!
valueExact: BigInt!
}
type ReceiptBalance @entity {
id: ID!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
receipt: Receipt!
account: Account!
value: BigDecimal!
valueExact: BigInt!
transferFromEvent: [ReceiptTransfer!]! @derivedFrom(field: "fromBalance")
transferToEvent: [ReceiptTransfer!]! @derivedFrom(field: "toBalance")
"The amount this receipt that has been confiscated for this account"
confiscated: BigInt! # Update if there is a ConfiscateReceipts for this OffchainAssetReceiptVault and Receipt and Account
}
type ReceiptOperator @entity {
id: ID!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
owner: Account!
operator: Account!
approved: Boolean!
}
type ReceiptTransfer implements Event @entity {
id: ID!
emitter: Account!
transaction: Transaction!
timestamp: BigInt!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
token: Receipt!
operator: Account!
from: Account
fromBalance: ReceiptBalance
to: Account
toBalance: ReceiptBalance
value: BigDecimal!
valueExact: BigInt!
}
type RoleGranted implements Event @entity {
id: ID!
emitter: Account!
account: Account!
sender: Account!
transaction: Transaction!
timestamp: BigInt!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
role: Role!
roleHolder: RoleHolder!
}
type RoleRevoked implements Event @entity {
id: ID!
emitter: Account!
account: Account!
sender: Account!
transaction: Transaction!
timestamp: BigInt!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
role: Role!
roleHolder: RoleHolder
}
type RoleHolder @entity {
id: ID!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
role: Role!
account: Account!
activeRoles: [Role!]
roleGrants: [RoleGranted!] @derivedFrom(field: "roleHolder")
roleRevoked: [RoleRevoked!] @derivedFrom(field: "roleHolder")
}
type Role @entity {
id: ID!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
roleHash: Bytes!
roleName: String! # match the hash to the roles in roles.sol
roleHolders: [RoleHolder!]! @derivedFrom(field: "role")
}
interface Event {
id: ID!
transaction: Transaction!
emitter: Account!
timestamp: BigInt!
}
type Transaction @entity {
id: ID!
timestamp: BigInt!
blockNumber: BigInt!
events: [Event!]! @derivedFrom(field: "transaction")
}
type Hash @entity {
id: ID!
owner: Account!
hash: String!
timestamp: BigInt!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
offchainAssetReceiptVaultDeployer: Deployer!
}
type User @entity {
id: ID!
hashCount: BigInt!
}
type Deployer @entity {
id: ID!
hashCount: BigInt!
hashes: [Hash!] @derivedFrom(field: "offchainAssetReceiptVaultDeployer")
}
type TokenHolder @entity {
id: ID!
address: Bytes!
offchainAssetReceiptVault: OffchainAssetReceiptVault!
balance: BigInt!
}