@dashevo/moderation-charters-contract 4.2.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,641 @@
1
+ {
2
+ "reason": {
3
+ "type": "object",
4
+ "documentsMutable": false,
5
+ "canBeDeleted": false,
6
+ "indices": [
7
+ {
8
+ "name": "byOwnerCode",
9
+ "properties": [
10
+ {
11
+ "$ownerId": "asc"
12
+ },
13
+ {
14
+ "code": "asc"
15
+ }
16
+ ],
17
+ "unique": true
18
+ }
19
+ ],
20
+ "properties": {
21
+ "code": {
22
+ "type": "string",
23
+ "minLength": 3,
24
+ "maxLength": 3,
25
+ "pattern": "^[A-Z]{3}$",
26
+ "description": "Three uppercase letters, unique per owner",
27
+ "position": 0
28
+ },
29
+ "label": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 64,
33
+ "position": 1
34
+ },
35
+ "description": {
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "maxLength": 1024,
39
+ "position": 2
40
+ }
41
+ },
42
+ "required": [
43
+ "$createdAt",
44
+ "code",
45
+ "label"
46
+ ],
47
+ "additionalProperties": false,
48
+ "description": "A ground for a moderation action"
49
+ },
50
+ "submittedCharter": {
51
+ "type": "object",
52
+ "documentsMutable": false,
53
+ "canBeDeleted": false,
54
+ "requiresIdentityDecryptionBoundedKey": 1,
55
+ "indices": [
56
+ {
57
+ "name": "byTargetContract",
58
+ "properties": [
59
+ {
60
+ "targetContractId": "asc"
61
+ },
62
+ {
63
+ "$createdAt": "asc"
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ "name": "byOwner",
69
+ "properties": [
70
+ {
71
+ "$ownerId": "asc"
72
+ }
73
+ ]
74
+ }
75
+ ],
76
+ "properties": {
77
+ "targetContractId": {
78
+ "type": "array",
79
+ "byteArray": true,
80
+ "minItems": 32,
81
+ "maxItems": 32,
82
+ "contentMediaType": "application/x.dash.dpp.identifier",
83
+ "refersTo": {
84
+ "type": "contract",
85
+ "contractRequirements": {
86
+ "moderation": "elected"
87
+ }
88
+ },
89
+ "description": "The contract to moderate",
90
+ "position": 0
91
+ },
92
+ "description": {
93
+ "type": "string",
94
+ "minLength": 1,
95
+ "maxLength": 4096,
96
+ "maxBytes": 4096,
97
+ "position": 1
98
+ },
99
+ "reasons": {
100
+ "type": "array",
101
+ "minItems": 0,
102
+ "maxItems": 64,
103
+ "uniqueItems": true,
104
+ "items": {
105
+ "type": "array",
106
+ "byteArray": true,
107
+ "minItems": 32,
108
+ "maxItems": 32,
109
+ "contentMediaType": "application/x.dash.dpp.identifier",
110
+ "refersTo": {
111
+ "type": "permanentDocument",
112
+ "documentType": "reason"
113
+ }
114
+ },
115
+ "description": "Reasons the team may act on; none means it cannot act",
116
+ "position": 2
117
+ },
118
+ "moderatorsShare": {
119
+ "type": "integer",
120
+ "minimum": 0,
121
+ "maximum": 100,
122
+ "description": "Percent of the declared moderators fee taken; absent is 100, 0 takes no rewards",
123
+ "position": 3
124
+ },
125
+ "rewardSplit": {
126
+ "type": "object",
127
+ "properties": {
128
+ "leader": {
129
+ "type": "integer",
130
+ "minimum": 0,
131
+ "maximum": 100,
132
+ "position": 0
133
+ },
134
+ "equal": {
135
+ "type": "integer",
136
+ "minimum": 0,
137
+ "maximum": 100,
138
+ "description": "Split equally among the other members",
139
+ "position": 1
140
+ },
141
+ "actions": {
142
+ "type": "integer",
143
+ "minimum": 0,
144
+ "maximum": 100,
145
+ "description": "Split by action count",
146
+ "position": 2
147
+ }
148
+ },
149
+ "required": [
150
+ "leader",
151
+ "equal",
152
+ "actions"
153
+ ],
154
+ "additionalProperties": false,
155
+ "description": "Percentages summing to 100",
156
+ "position": 4
157
+ }
158
+ },
159
+ "required": [
160
+ "$createdAt",
161
+ "targetContractId",
162
+ "description",
163
+ "reasons",
164
+ "rewardSplit"
165
+ ],
166
+ "propertyConstraints": {
167
+ "rewardSplitIsWhole": {
168
+ "equal": [
169
+ {
170
+ "add": [
171
+ "rewardSplit.leader",
172
+ "rewardSplit.equal",
173
+ "rewardSplit.actions"
174
+ ]
175
+ },
176
+ 100
177
+ ]
178
+ }
179
+ },
180
+ "additionalProperties": false,
181
+ "description": "A proposal to moderate a contract"
182
+ },
183
+ "joinRequest": {
184
+ "type": "object",
185
+ "documentsMutable": false,
186
+ "canBeDeleted": false,
187
+ "requiresIdentityEncryptionBoundedKey": 1,
188
+ "indices": [
189
+ {
190
+ "name": "bySubmittedCharter",
191
+ "properties": [
192
+ {
193
+ "submittedCharterId": "asc"
194
+ },
195
+ {
196
+ "$ownerId": "asc"
197
+ }
198
+ ],
199
+ "unique": true
200
+ },
201
+ {
202
+ "name": "byOwner",
203
+ "properties": [
204
+ {
205
+ "$ownerId": "asc"
206
+ }
207
+ ]
208
+ }
209
+ ],
210
+ "properties": {
211
+ "submittedCharterId": {
212
+ "type": "array",
213
+ "byteArray": true,
214
+ "minItems": 32,
215
+ "maxItems": 32,
216
+ "contentMediaType": "application/x.dash.dpp.identifier",
217
+ "refersTo": {
218
+ "type": "permanentDocument",
219
+ "documentType": "submittedCharter",
220
+ "propertyAgreement": {
221
+ "recipientId": "$ownerId"
222
+ }
223
+ },
224
+ "position": 0
225
+ },
226
+ "recipientId": {
227
+ "type": "array",
228
+ "byteArray": true,
229
+ "minItems": 32,
230
+ "maxItems": 32,
231
+ "contentMediaType": "application/x.dash.dpp.identifier",
232
+ "refersTo": {
233
+ "type": "identityPublicKey",
234
+ "keyIdProperty": "recipientKeyId",
235
+ "keyRequirements": {
236
+ "purpose": "decryption",
237
+ "boundTo": "submittedCharter"
238
+ }
239
+ },
240
+ "description": "The proposal's leader",
241
+ "position": 1
242
+ },
243
+ "recipientKeyId": {
244
+ "type": "integer",
245
+ "minimum": 0,
246
+ "maximum": 4294967295,
247
+ "position": 2
248
+ },
249
+ "senderKeyId": {
250
+ "type": "integer",
251
+ "minimum": 0,
252
+ "maximum": 4294967295,
253
+ "refersTo": {
254
+ "type": "identityPublicKey",
255
+ "identityProperty": "$ownerId",
256
+ "keyRequirements": {
257
+ "purpose": "encryption",
258
+ "boundTo": "joinRequest"
259
+ }
260
+ },
261
+ "position": 3
262
+ },
263
+ "encryptedMessage": {
264
+ "type": "array",
265
+ "byteArray": true,
266
+ "minItems": 32,
267
+ "maxItems": 1040,
268
+ "encryptedFor": {
269
+ "recipient": "recipientId",
270
+ "recipientKey": "recipientKeyId",
271
+ "senderKey": "senderKeyId",
272
+ "scheme": "ecdh-secp256k1-aes256-cbc"
273
+ },
274
+ "description": "Readable by the leader only",
275
+ "position": 4
276
+ }
277
+ },
278
+ "required": [
279
+ "$createdAt",
280
+ "submittedCharterId",
281
+ "recipientId",
282
+ "recipientKeyId",
283
+ "senderKeyId",
284
+ "encryptedMessage"
285
+ ],
286
+ "additionalProperties": false,
287
+ "description": "An offer to join a proposal's team"
288
+ },
289
+ "electedCharter": {
290
+ "type": "object",
291
+ "documentsMutable": false,
292
+ "canBeDeleted": false,
293
+ "indices": [
294
+ {
295
+ "name": "byTargetContract",
296
+ "properties": [
297
+ {
298
+ "targetContractId": "asc"
299
+ }
300
+ ],
301
+ "unique": true,
302
+ "contested": {
303
+ "resolution": 1,
304
+ "description": "Contest for the moderation seat"
305
+ }
306
+ },
307
+ {
308
+ "name": "bySubmittedCharter",
309
+ "properties": [
310
+ {
311
+ "submittedCharterId": "asc"
312
+ }
313
+ ]
314
+ }
315
+ ],
316
+ "properties": {
317
+ "targetContractId": {
318
+ "type": "array",
319
+ "byteArray": true,
320
+ "minItems": 32,
321
+ "maxItems": 32,
322
+ "contentMediaType": "application/x.dash.dpp.identifier",
323
+ "refersTo": {
324
+ "type": "contract",
325
+ "contractRequirements": {
326
+ "moderation": "electionOpen"
327
+ }
328
+ },
329
+ "position": 0
330
+ },
331
+ "submittedCharterId": {
332
+ "type": "array",
333
+ "byteArray": true,
334
+ "minItems": 32,
335
+ "maxItems": 32,
336
+ "contentMediaType": "application/x.dash.dpp.identifier",
337
+ "refersTo": {
338
+ "type": "permanentDocument",
339
+ "documentType": "submittedCharter",
340
+ "propertyAgreement": {
341
+ "$ownerId": "$ownerId",
342
+ "targetContractId": "targetContractId"
343
+ }
344
+ },
345
+ "position": 1
346
+ },
347
+ "members": {
348
+ "type": "array",
349
+ "minItems": 0,
350
+ "maxItems": 15,
351
+ "uniqueItems": true,
352
+ "items": {
353
+ "type": "array",
354
+ "byteArray": true,
355
+ "minItems": 32,
356
+ "maxItems": 32,
357
+ "contentMediaType": "application/x.dash.dpp.identifier",
358
+ "distinctFrom": "$ownerId",
359
+ "refersTo": {
360
+ "type": "permanentDocument",
361
+ "documentType": "joinRequest",
362
+ "lookup": {
363
+ "index": "bySubmittedCharter",
364
+ "keys": {
365
+ "submittedCharterId": "submittedCharterId",
366
+ "$ownerId": "."
367
+ }
368
+ }
369
+ }
370
+ },
371
+ "description": "Team besides the leader, each with a join request",
372
+ "position": 2
373
+ }
374
+ },
375
+ "required": [
376
+ "$createdAt",
377
+ "targetContractId",
378
+ "submittedCharterId",
379
+ "members"
380
+ ],
381
+ "additionalProperties": false,
382
+ "description": "A proposal put to the vote with its team"
383
+ },
384
+ "addedModerator": {
385
+ "type": "object",
386
+ "documentsMutable": false,
387
+ "canBeDeleted": true,
388
+ "indices": [
389
+ {
390
+ "name": "byElectedCharterMember",
391
+ "properties": [
392
+ {
393
+ "electedCharterId": "asc"
394
+ },
395
+ {
396
+ "memberId": "asc"
397
+ }
398
+ ],
399
+ "unique": true
400
+ }
401
+ ],
402
+ "properties": {
403
+ "electedCharterId": {
404
+ "type": "array",
405
+ "byteArray": true,
406
+ "minItems": 32,
407
+ "maxItems": 32,
408
+ "contentMediaType": "application/x.dash.dpp.identifier",
409
+ "refersTo": {
410
+ "type": "permanentDocument",
411
+ "documentType": "electedCharter",
412
+ "propertyAgreement": {
413
+ "$ownerId": "$ownerId",
414
+ "submittedCharterId": "submittedCharterId"
415
+ }
416
+ },
417
+ "description": "The seated charter; only its leader may add",
418
+ "position": 0
419
+ },
420
+ "submittedCharterId": {
421
+ "type": "array",
422
+ "byteArray": true,
423
+ "minItems": 32,
424
+ "maxItems": 32,
425
+ "contentMediaType": "application/x.dash.dpp.identifier",
426
+ "position": 1
427
+ },
428
+ "memberId": {
429
+ "type": "array",
430
+ "byteArray": true,
431
+ "minItems": 32,
432
+ "maxItems": 32,
433
+ "contentMediaType": "application/x.dash.dpp.identifier",
434
+ "distinctFrom": "$ownerId",
435
+ "refersTo": {
436
+ "type": "permanentDocument",
437
+ "documentType": "joinRequest",
438
+ "lookup": {
439
+ "index": "bySubmittedCharter",
440
+ "keys": {
441
+ "submittedCharterId": "submittedCharterId",
442
+ "$ownerId": "."
443
+ }
444
+ }
445
+ },
446
+ "description": "An identity that asked to join the proposal",
447
+ "position": 2
448
+ }
449
+ },
450
+ "required": [
451
+ "$createdAt",
452
+ "electedCharterId",
453
+ "submittedCharterId",
454
+ "memberId"
455
+ ],
456
+ "additionalProperties": false,
457
+ "description": "A member the leader adds after the election, at most the target's maxAddedModerators at a time; deleting it takes the member off the team"
458
+ },
459
+ "removedModerator": {
460
+ "type": "object",
461
+ "documentsMutable": false,
462
+ "canBeDeleted": true,
463
+ "indices": [
464
+ {
465
+ "name": "byElectedCharterMember",
466
+ "properties": [
467
+ {
468
+ "electedCharterId": "asc"
469
+ },
470
+ {
471
+ "memberId": "asc"
472
+ }
473
+ ],
474
+ "unique": true
475
+ }
476
+ ],
477
+ "properties": {
478
+ "electedCharterId": {
479
+ "type": "array",
480
+ "byteArray": true,
481
+ "minItems": 32,
482
+ "maxItems": 32,
483
+ "contentMediaType": "application/x.dash.dpp.identifier",
484
+ "refersTo": {
485
+ "type": "permanentDocument",
486
+ "documentType": "electedCharter",
487
+ "propertyAgreement": {
488
+ "$ownerId": "$ownerId"
489
+ }
490
+ },
491
+ "description": "The seated charter; only its leader may remove",
492
+ "position": 0
493
+ },
494
+ "memberId": {
495
+ "type": "array",
496
+ "byteArray": true,
497
+ "minItems": 32,
498
+ "maxItems": 32,
499
+ "contentMediaType": "application/x.dash.dpp.identifier",
500
+ "distinctFrom": "$ownerId",
501
+ "refersTo": {
502
+ "type": "listElement",
503
+ "documentType": "electedCharter",
504
+ "propertyAgreement": {
505
+ "electedCharterId": "$id"
506
+ },
507
+ "inList": "members"
508
+ },
509
+ "description": "An elected member of the charter; an added one is taken off by deleting its addition",
510
+ "position": 1
511
+ }
512
+ },
513
+ "required": [
514
+ "$createdAt",
515
+ "electedCharterId",
516
+ "memberId"
517
+ ],
518
+ "additionalProperties": false,
519
+ "description": "An elected member the leader takes off the team; deleting it puts them back"
520
+ },
521
+ "resignationRequest": {
522
+ "type": "object",
523
+ "documentsMutable": false,
524
+ "canBeDeleted": true,
525
+ "ownerRefersTo": {
526
+ "anyOf": [
527
+ {
528
+ "type": "listElement",
529
+ "documentType": "electedCharter",
530
+ "propertyAgreement": {
531
+ "electedCharterId": "$id"
532
+ },
533
+ "inList": "members"
534
+ },
535
+ {
536
+ "type": "deletableDocument",
537
+ "documentType": "addedModerator",
538
+ "lookup": {
539
+ "index": "byElectedCharterMember",
540
+ "keys": {
541
+ "electedCharterId": "electedCharterId",
542
+ "memberId": "."
543
+ }
544
+ }
545
+ }
546
+ ]
547
+ },
548
+ "indices": [
549
+ {
550
+ "name": "byElectedCharterOwner",
551
+ "properties": [
552
+ {
553
+ "electedCharterId": "asc"
554
+ },
555
+ {
556
+ "$ownerId": "asc"
557
+ }
558
+ ],
559
+ "unique": true
560
+ }
561
+ ],
562
+ "properties": {
563
+ "electedCharterId": {
564
+ "type": "array",
565
+ "byteArray": true,
566
+ "minItems": 32,
567
+ "maxItems": 32,
568
+ "contentMediaType": "application/x.dash.dpp.identifier",
569
+ "refersTo": {
570
+ "type": "permanentDocument",
571
+ "documentType": "electedCharter",
572
+ "propertyAgreement": {
573
+ "recipientId": "$ownerId"
574
+ }
575
+ },
576
+ "position": 0
577
+ },
578
+ "recipientId": {
579
+ "type": "array",
580
+ "byteArray": true,
581
+ "minItems": 32,
582
+ "maxItems": 32,
583
+ "contentMediaType": "application/x.dash.dpp.identifier",
584
+ "refersTo": {
585
+ "type": "identityPublicKey",
586
+ "keyIdProperty": "recipientKeyId",
587
+ "keyRequirements": {
588
+ "purpose": "decryption",
589
+ "boundTo": "submittedCharter"
590
+ }
591
+ },
592
+ "description": "The leader",
593
+ "position": 1
594
+ },
595
+ "recipientKeyId": {
596
+ "type": "integer",
597
+ "minimum": 0,
598
+ "maximum": 4294967295,
599
+ "position": 2
600
+ },
601
+ "senderKeyId": {
602
+ "type": "integer",
603
+ "minimum": 0,
604
+ "maximum": 4294967295,
605
+ "refersTo": {
606
+ "type": "identityPublicKey",
607
+ "identityProperty": "$ownerId",
608
+ "keyRequirements": {
609
+ "purpose": "encryption",
610
+ "boundTo": "joinRequest"
611
+ }
612
+ },
613
+ "position": 3
614
+ },
615
+ "encryptedMessage": {
616
+ "type": "array",
617
+ "byteArray": true,
618
+ "minItems": 32,
619
+ "maxItems": 1040,
620
+ "encryptedFor": {
621
+ "recipient": "recipientId",
622
+ "recipientKey": "recipientKeyId",
623
+ "senderKey": "senderKeyId",
624
+ "scheme": "ecdh-secp256k1-aes256-cbc"
625
+ },
626
+ "description": "Why the member leaves, readable by the leader only",
627
+ "position": 4
628
+ }
629
+ },
630
+ "required": [
631
+ "$createdAt",
632
+ "electedCharterId",
633
+ "recipientId",
634
+ "recipientKeyId",
635
+ "senderKeyId",
636
+ "encryptedMessage"
637
+ ],
638
+ "additionalProperties": false,
639
+ "description": "A member asking to leave; the leader removes them, and deleting it withdraws the request"
640
+ }
641
+ }
package/src/error.rs ADDED
@@ -0,0 +1,17 @@
1
+ use platform_version::version::FeatureVersion;
2
+
3
+ #[derive(thiserror::Error, Debug)]
4
+ pub enum Error {
5
+ /// Platform expected some specific versions
6
+ #[error("platform unknown version on {method}, received: {received}")]
7
+ UnknownVersionMismatch {
8
+ /// method
9
+ method: String,
10
+ /// the allowed versions for this method
11
+ known_versions: Vec<FeatureVersion>,
12
+ /// requested core height
13
+ received: FeatureVersion,
14
+ },
15
+ #[error("schema deserialize error: {0}")]
16
+ InvalidSchemaJson(#[from] serde_json::Error),
17
+ }