-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
596 lines (577 loc) · 10.1 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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
scalar Bytes
scalar BigDecimal
"""
Contributions of an asset to an entity
"""
type AssetContributions @entity {
"""
"asset-0" for global
"asset-number" for daily global
"asset-address" for community or contributor
"asset-address-number" for daily community
"""
id: ID!
"""
contributed asset
"""
asset: Bytes!
"""
contributed amount (normalized)
"""
amount: BigDecimal!
}
"""
UBI community
"""
type CommunityEntity @entity {
"""
community address
"""
id: ID!
"""
community start day id (block timestamp / 86400). Useful to update daily entities when migrating
"""
startDayId: Int!
"""
community state (0: active, 1: removed, 2: locked)
"""
state: Int!
"""
address of the previous community, if migrated/copied.
"""
previous: Bytes
"""
address of the community it was migrated/copied to
"""
next: Bytes
"""
UBI parameter claim amount (normalized)
"""
claimAmount: BigDecimal!
"""
UBI parameter original claim amount (normalized)
"""
originalClaimAmount: BigDecimal!
"""
deprecated
"""
maxClaim: BigDecimal!
"""
UBI parameter max total claim (normalized)
"""
maxTotalClaim: BigDecimal!
"""
UBI parameter decrease step (normalized)
"""
decreaseStep: BigDecimal!
"""
UBI parameter base interval (in blocks)
"""
baseInterval: Int!
"""
UBI parameter increment interval (in blocks)
"""
incrementInterval: Int!
"""
total active beneficiaries
"""
beneficiaries: Int!
"""
max beneficiaries
"""
maxBeneficiaries: Int!
"""
total removed beneficiaries
"""
removedBeneficiaries: Int!
"""
total locked beneficiaries
"""
lockedBeneficiaries: Int!
"""
total active managers
"""
managers: Int!
"""
total removed managers
"""
removedManagers: Int!
"""
total claimed (normalized)
"""
claimed: BigDecimal!
"""
total claims
"""
claims: Int!
"""
total received from contributions (normalized)
"""
contributed: BigDecimal!
"""
total contributors (normalized)
"""
contributors: Int!
"""
contributions in each asset
"""
contributions: [AssetContributions!]!
"""
active community managers array
"""
managerList: [ManagerEntity!]!
"""
estimated funds on contract (normalized) (raised - claimed)
"""
estimatedFunds: BigDecimal!
"""
community min tranche (normalized)
"""
minTranche: BigDecimal!
"""
community max tranche (normalized)
"""
maxTranche: BigDecimal!
"""
community's last activity, either any activity from manager or beneficiary
"""
lastActivity: Int
}
# when a community is migrated, CommunityDataEntity are migrated too
# replacing the old community address with the new one on the id and community fields
"""
Community activity per day
"""
type CommunityDailyEntity @entity {
"""
community address + day id (block timestamp / 86400)
"""
id: ID!
"""
community object
"""
community: CommunityEntity!
"""
day id (block timestamp / 86400)
"""
dayId: Int!
"""
difference of beneficiaries (negative if more removed than added)
"""
beneficiaries: Int!
"""
difference of managers (negative if more removed than added)
"""
managers: Int!
"""
total claimed (normalized)
"""
claimed: BigDecimal!
"""
total claims
"""
claims: Int!
"""
total contributed (normalized)
"""
contributed: BigDecimal!
"""
total contributors (normalized)
"""
contributors: Int!
"""
contributions in each asset
"""
contributions: [AssetContributions!]!
"""
volume transacted in cUSD (normalized)
"""
volume: BigDecimal!
"""
number of transactions
"""
transactions: Int!
"""
number of reached unique addresses
"""
reach: Int!
"""
funding rate: (monthly raised - monthly claimed) / monthly raised
"""
fundingRate: BigDecimal!
}
"""
Global UBI activity per day. Be aware of the day id.
Day id 0 (zero) is reserved to global activity.
"""
type UBIDailyEntity @entity {
"""
day id (block timestamp / 86400)
"""
id: ID!
"""
difference of communities (negative if more removed than added)
"""
communities: Int!
"""
difference of beneficiaries (negative if more removed than added)
"""
beneficiaries: Int!
"""
difference of managers (negative if more removed than added)
"""
managers: Int!
"""
total claimed (normalized)
"""
claimed: BigDecimal!
"""
total claims
"""
claims: Int!
"""
total contributed (normalized)
"""
contributed: BigDecimal!
"""
total contributors (normalized)
"""
contributors: Int!
"""
contributions in each asset
"""
contributions: [AssetContributions!]!
"""
volume transacted in cUSD (normalized)
"""
volume: BigDecimal!
"""
number of transactions
"""
transactions: Int!
"""
number of reached unique addresses
"""
reach: Int!
"""
funding rate: (monthly raised - monthly claimed) / monthly raised
"""
fundingRate: BigDecimal!
}
"""
UBI community managers
"""
type ManagerEntity @entity {
"""
tx hash if this address is added on a new community, otherwise address
"""
id: ID!
"""
manager address
"""
address: Bytes!
"""
community object from which this manager belongs to
"""
community: CommunityEntity!
"""
manager state on the community (0: active, 1: removed)
"""
state: Int!
"""
total beneficiaries added to this community by this manager
"""
added: Int!
"""
total beneficiaries removed from this community by this manager
"""
removed: Int!
"""
tx timestamp of when this manager was added to this community
"""
since: Int!
"""
tx timestamp of when this manager was removed from this community
"""
until: Int!
"""
added by
"""
addedBy: Bytes!
"""
removed by
"""
removedBy: Bytes
"""
manager's last activity
"""
lastActivity: Int
}
"""
UBI community beneficiary
"""
type BeneficiaryEntity @entity {
"""
tx hash if this address is added on a new community, otherwise address
"""
id: ID!
"""
beneficiary address
"""
address: Bytes!
"""
community object from which this beneficiary belongs to
"""
community: CommunityEntity!
"""
beneficiary state on the community (0: active, 1: removed, 2: locked)
"""
state: Int!
"""
last time this beneficiary claimed in this community
"""
lastClaimAt: Int!
"""
pre last time this beneficiary claimed in this community
"""
preLastClaimAt: Int!
"""
number of claims made by this beneficiary
"""
claims: Int!
"""
total amount of cUSD claimed by this beneficiary (normalized)
"""
claimed: BigDecimal!
"""
tx timestamp of when this beneficiary was added to this community
"""
since: Int!
"""
added by
"""
addedBy: Bytes!
"""
removed by
"""
removedBy: Bytes
"""
beneficiary's last activity
"""
lastActivity: Int
}
enum ActivityCode {
ADDED
REMOVED
}
"""
Beneficiry or manager activity registry
"""
type UserActivityEntity @entity {
"""
tx hash
"""
id: ID!
"""
user address
"""
user: Bytes!
"""
address of the user who did the activity
"""
by: Bytes!
"""
which community the user belong to whe activity happened
"""
community: CommunityEntity!
"""
activity timestamp in seconds (block timestamp)
"""
timestamp: Int!
"""
activity code ('ADDED' or 'REMOVED')
"""
activity: ActivityCode!
}
"""
User transactions when transacting with a beneficiary
"""
type UserTransactionsEntity @entity {
"""
address of the user
"""
id: ID!
"""
volume transacted by this user in cUSD (normalized)
"""
volume: BigDecimal!
"""
number of transactions sent by this user
"""
sentTxs: Int!
"""
number of transactions received by this user
"""
receivedTxs: Int!
}
"""
User transaction with a given address
"""
type UserTransactionWithEntity @entity {
"""
pattern: fromAddress-toAddress
"""
id: ID!
"""
last transaction day id (block timestamp / 86400)
"""
lastTransaction: Int!
}
"""
Contributor contributions to an address
"""
type ContributorContributionsEntity @entity {
"""
contributor address + to address
"""
id: ID!
"""
last contribution day id (block timestamp / 86400)
"""
lastContribution: Int!
}
"""
Contributor
"""
type ContributorEntity @entity {
"""
contributor address
"""
id: ID!
"""
contributions in each asset
"""
contributions: [AssetContributions!]!
"""
last contribution day id (block timestamp / 86400)
"""
lastContribution: Int!
"""
amount of PACT on wallet (normalized)
"""
pact: BigDecimal!
"""
amount of PACT staking (normalized)
"""
staking: BigDecimal!
"""
last PACT activity day id (block timestamp / 86400)
"""
lastPACTActivity: Int
}
# Deposit and Redirect
type DepositAsset @entity {
"""
{{ key }}-{{ tokenAddress }}-{{ dayId }} for DepositRedirectDaily
{{ key }}-{{ tokenAddress }}-{{ depositorAddress }} for Depositor
"""
id: ID!
"""
asset deposited
"""
asset: Bytes!
"""
amount deposited (normalized)
"""
deposited: BigDecimal!
"""
interest donated (normalized)
"""
interest: BigDecimal!
}
type Depositor @entity {
"""
depositor address
"""
id: ID!
"""
deposited assets
"""
assets: [DepositAsset!]!
"""
first deposit timestamp
"""
firstDeposit: Int!
"""
lastDeposit timestamp
"""
lastDeposit: Int!
"""
number of time that donated the interest
"""
redirects: Int!
"""
withdraw timestamp
"""
withdraw: Int
}
type DepositRedirectDaily @entity {
"""
day id
"0" for global
"""
id: ID!
"""
deposited assets
"""
assets: [DepositAsset!]!
"""
unique depositors
"""
depositors: Int!
}
type ReferralCampaign @entity {
"""
campaign id
"""
id: ID!
"""
campaign start timestamp
"""
startTime: Int!
"""
campaign end timestamp
"""
endTime: Int!
"""
campaign reward amount
"""
rewardAmount: BigDecimal!
"""
campaign max referrals per user
"""
maxReferralLinks: Int!
}
type UserReferral @entity {
"""
referral id
{{ campaignId }}-{{ userAddress }}
"""
id: ID!
"""
user address
"""
user: Bytes!
"""
campaign id
"""
campaign: ReferralCampaign!
"""
users that have used this referral link
"""
usedBy: [Bytes!]!
"""
referral number od usages
"""
usages: Int!
}