@bloxchain/contracts 1.0.0-alpha.7 → 1.0.0

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +8 -9
  3. package/abi/BaseStateMachine.abi.json +773 -822
  4. package/abi/EngineBlox.abi.json +562 -552
  5. package/abi/GuardController.abi.json +1597 -1609
  6. package/abi/GuardControllerDefinitions.abi.json +235 -199
  7. package/abi/IDefinition.abi.json +57 -47
  8. package/abi/RuntimeRBAC.abi.json +841 -842
  9. package/abi/RuntimeRBACDefinitions.abi.json +212 -202
  10. package/abi/SecureOwnable.abi.json +1365 -1349
  11. package/abi/SecureOwnableDefinitions.abi.json +174 -164
  12. package/core/AUDIT.md +45 -0
  13. package/core/access/RuntimeRBAC.sol +130 -61
  14. package/core/access/interface/IRuntimeRBAC.sol +3 -3
  15. package/core/access/lib/definitions/RuntimeRBACDefinitions.sol +7 -3
  16. package/core/base/BaseStateMachine.sol +971 -967
  17. package/core/base/interface/IBaseStateMachine.sol +153 -160
  18. package/core/execution/GuardController.sol +89 -75
  19. package/core/execution/interface/IGuardController.sol +146 -160
  20. package/core/execution/lib/definitions/GuardControllerDefinitions.sol +136 -25
  21. package/core/lib/EngineBlox.sol +577 -327
  22. package/core/lib/interfaces/IDefinition.sol +49 -49
  23. package/core/lib/interfaces/IEventForwarder.sol +4 -2
  24. package/core/lib/utils/SharedValidation.sol +534 -490
  25. package/core/pattern/Account.sol +84 -75
  26. package/core/security/SecureOwnable.sol +446 -390
  27. package/core/security/interface/ISecureOwnable.sol +105 -105
  28. package/core/security/lib/definitions/SecureOwnableDefinitions.sol +49 -17
  29. package/package.json +51 -49
  30. package/standards/behavior/ICopyable.sol +3 -11
  31. package/standards/hooks/IOnActionHook.sol +1 -1
  32. package/abi/AccountBlox.abi.json +0 -3935
  33. package/abi/BareBlox.abi.json +0 -1378
  34. package/abi/RoleBlox.abi.json +0 -2983
  35. package/abi/SecureBlox.abi.json +0 -2753
  36. package/abi/SimpleRWA20.abi.json +0 -4032
  37. package/abi/SimpleRWA20Definitions.abi.json +0 -191
  38. package/abi/SimpleVault.abi.json +0 -3407
  39. package/abi/SimpleVaultDefinitions.abi.json +0 -269
  40. package/core/research/BloxchainWallet.sol +0 -133
  41. package/core/research/FactoryBlox/FactoryBlox.sol +0 -343
  42. package/core/research/FactoryBlox/FactoryBloxDefinitions.sol +0 -143
  43. package/core/research/erc1155-blox/ERC1155Blox.sol +0 -169
  44. package/core/research/erc1155-blox/lib/definitions/ERC1155BloxDefinitions.sol +0 -203
  45. package/core/research/erc20-blox/ERC20Blox.sol +0 -167
  46. package/core/research/erc20-blox/lib/definitions/ERC20BloxDefinitions.sol +0 -185
  47. package/core/research/erc721-blox/ERC721Blox.sol +0 -131
  48. package/core/research/erc721-blox/lib/definitions/ERC721BloxDefinitions.sol +0 -172
  49. package/core/research/lending-blox/.gitkeep +0 -1
  50. package/core/research/p2p-blox/P2PBlox.sol +0 -266
  51. package/core/research/p2p-blox/README.md +0 -85
  52. package/core/research/p2p-blox/lib/definitions/P2PBloxDefinitions.sol +0 -19
@@ -1,376 +1,386 @@
1
1
  [
2
2
  {
3
- "inputs": [],
3
+ "type": "function",
4
4
  "name": "ROLE_CONFIG_BATCH",
5
+ "inputs": [],
5
6
  "outputs": [
6
7
  {
7
- "internalType": "bytes32",
8
8
  "name": "",
9
- "type": "bytes32"
9
+ "type": "bytes32",
10
+ "internalType": "bytes32"
10
11
  }
11
12
  ],
12
- "stateMutability": "view",
13
- "type": "function"
13
+ "stateMutability": "view"
14
14
  },
15
15
  {
16
- "inputs": [],
16
+ "type": "function",
17
17
  "name": "ROLE_CONFIG_BATCH_EXECUTE_SELECTOR",
18
+ "inputs": [],
18
19
  "outputs": [
19
20
  {
20
- "internalType": "bytes4",
21
21
  "name": "",
22
- "type": "bytes4"
22
+ "type": "bytes4",
23
+ "internalType": "bytes4"
23
24
  }
24
25
  ],
25
- "stateMutability": "view",
26
- "type": "function"
26
+ "stateMutability": "view"
27
27
  },
28
28
  {
29
- "inputs": [],
29
+ "type": "function",
30
30
  "name": "ROLE_CONFIG_BATCH_META_SELECTOR",
31
+ "inputs": [],
31
32
  "outputs": [
32
33
  {
33
- "internalType": "bytes4",
34
34
  "name": "",
35
- "type": "bytes4"
35
+ "type": "bytes4",
36
+ "internalType": "bytes4"
36
37
  }
37
38
  ],
38
- "stateMutability": "view",
39
- "type": "function"
39
+ "stateMutability": "view"
40
40
  },
41
41
  {
42
- "inputs": [],
43
- "name": "getFunctionSchemas",
44
- "outputs": [
42
+ "type": "function",
43
+ "name": "encodeAddFunctionToRole",
44
+ "inputs": [
45
45
  {
46
+ "name": "roleHash",
47
+ "type": "bytes32",
48
+ "internalType": "bytes32"
49
+ },
50
+ {
51
+ "name": "functionPermission",
52
+ "type": "tuple",
53
+ "internalType": "struct EngineBlox.FunctionPermission",
46
54
  "components": [
47
55
  {
48
- "internalType": "string",
49
- "name": "functionSignature",
50
- "type": "string"
51
- },
52
- {
53
- "internalType": "bytes4",
54
56
  "name": "functionSelector",
55
- "type": "bytes4"
56
- },
57
- {
58
- "internalType": "bytes32",
59
- "name": "operationType",
60
- "type": "bytes32"
61
- },
62
- {
63
- "internalType": "string",
64
- "name": "operationName",
65
- "type": "string"
57
+ "type": "bytes4",
58
+ "internalType": "bytes4"
66
59
  },
67
60
  {
68
- "internalType": "uint16",
69
- "name": "supportedActionsBitmap",
70
- "type": "uint16"
71
- },
72
- {
73
- "internalType": "bool",
74
- "name": "isProtected",
75
- "type": "bool"
61
+ "name": "grantedActionsBitmap",
62
+ "type": "uint16",
63
+ "internalType": "uint16"
76
64
  },
77
65
  {
78
- "internalType": "bytes4[]",
79
66
  "name": "handlerForSelectors",
80
- "type": "bytes4[]"
67
+ "type": "bytes4[]",
68
+ "internalType": "bytes4[]"
81
69
  }
82
- ],
83
- "internalType": "struct EngineBlox.FunctionSchema[]",
84
- "name": "",
85
- "type": "tuple[]"
70
+ ]
86
71
  }
87
72
  ],
88
- "stateMutability": "pure",
89
- "type": "function"
90
- },
91
- {
92
- "inputs": [],
93
- "name": "getRolePermissions",
94
73
  "outputs": [
95
74
  {
96
- "components": [
97
- {
98
- "internalType": "bytes32[]",
99
- "name": "roleHashes",
100
- "type": "bytes32[]"
101
- },
102
- {
103
- "components": [
104
- {
105
- "internalType": "bytes4",
106
- "name": "functionSelector",
107
- "type": "bytes4"
108
- },
109
- {
110
- "internalType": "uint16",
111
- "name": "grantedActionsBitmap",
112
- "type": "uint16"
113
- },
114
- {
115
- "internalType": "bytes4[]",
116
- "name": "handlerForSelectors",
117
- "type": "bytes4[]"
118
- }
119
- ],
120
- "internalType": "struct EngineBlox.FunctionPermission[]",
121
- "name": "functionPermissions",
122
- "type": "tuple[]"
123
- }
124
- ],
125
- "internalType": "struct IDefinition.RolePermission",
126
75
  "name": "",
127
- "type": "tuple"
76
+ "type": "bytes",
77
+ "internalType": "bytes"
128
78
  }
129
79
  ],
130
- "stateMutability": "pure",
131
- "type": "function"
80
+ "stateMutability": "pure"
132
81
  },
133
82
  {
134
- "inputs": [],
135
- "name": "getRoleConfigActionSpecs",
136
- "outputs": [
83
+ "type": "function",
84
+ "name": "encodeAddWallet",
85
+ "inputs": [
137
86
  {
138
- "internalType": "string[]",
139
- "name": "actionNames",
140
- "type": "string[]"
87
+ "name": "roleHash",
88
+ "type": "bytes32",
89
+ "internalType": "bytes32"
141
90
  },
142
91
  {
143
- "internalType": "string[]",
144
- "name": "formats",
145
- "type": "string[]"
92
+ "name": "wallet",
93
+ "type": "address",
94
+ "internalType": "address"
95
+ }
96
+ ],
97
+ "outputs": [
98
+ {
99
+ "name": "",
100
+ "type": "bytes",
101
+ "internalType": "bytes"
146
102
  }
147
103
  ],
148
- "stateMutability": "pure",
149
- "type": "function"
104
+ "stateMutability": "pure"
150
105
  },
151
106
  {
107
+ "type": "function",
108
+ "name": "encodeCreateRole",
152
109
  "inputs": [
153
110
  {
154
- "internalType": "string",
155
111
  "name": "roleName",
156
- "type": "string"
112
+ "type": "string",
113
+ "internalType": "string"
157
114
  },
158
115
  {
159
- "internalType": "uint256",
160
116
  "name": "maxWallets",
161
- "type": "uint256"
117
+ "type": "uint256",
118
+ "internalType": "uint256"
162
119
  }
163
120
  ],
164
- "name": "encodeCreateRole",
165
121
  "outputs": [
166
122
  {
167
- "internalType": "bytes",
168
123
  "name": "",
169
- "type": "bytes"
124
+ "type": "bytes",
125
+ "internalType": "bytes"
170
126
  }
171
127
  ],
172
- "stateMutability": "pure",
173
- "type": "function"
128
+ "stateMutability": "pure"
174
129
  },
175
130
  {
131
+ "type": "function",
132
+ "name": "encodeRemoveFunctionFromRole",
176
133
  "inputs": [
177
134
  {
178
- "internalType": "bytes32",
179
135
  "name": "roleHash",
180
- "type": "bytes32"
136
+ "type": "bytes32",
137
+ "internalType": "bytes32"
138
+ },
139
+ {
140
+ "name": "functionSelector",
141
+ "type": "bytes4",
142
+ "internalType": "bytes4"
181
143
  }
182
144
  ],
183
- "name": "encodeRemoveRole",
184
145
  "outputs": [
185
146
  {
186
- "internalType": "bytes",
187
147
  "name": "",
188
- "type": "bytes"
148
+ "type": "bytes",
149
+ "internalType": "bytes"
189
150
  }
190
151
  ],
191
- "stateMutability": "pure",
192
- "type": "function"
152
+ "stateMutability": "pure"
193
153
  },
194
154
  {
155
+ "type": "function",
156
+ "name": "encodeRemoveRole",
195
157
  "inputs": [
196
158
  {
197
- "internalType": "bytes32",
198
159
  "name": "roleHash",
199
- "type": "bytes32"
200
- },
201
- {
202
- "internalType": "address",
203
- "name": "wallet",
204
- "type": "address"
160
+ "type": "bytes32",
161
+ "internalType": "bytes32"
205
162
  }
206
163
  ],
207
- "name": "encodeAddWallet",
208
164
  "outputs": [
209
165
  {
210
- "internalType": "bytes",
211
166
  "name": "",
212
- "type": "bytes"
167
+ "type": "bytes",
168
+ "internalType": "bytes"
213
169
  }
214
170
  ],
215
- "stateMutability": "pure",
216
- "type": "function"
171
+ "stateMutability": "pure"
217
172
  },
218
173
  {
174
+ "type": "function",
175
+ "name": "encodeRevokeWallet",
219
176
  "inputs": [
220
177
  {
221
- "internalType": "bytes32",
222
178
  "name": "roleHash",
223
- "type": "bytes32"
179
+ "type": "bytes32",
180
+ "internalType": "bytes32"
224
181
  },
225
182
  {
226
- "internalType": "address",
227
183
  "name": "wallet",
228
- "type": "address"
184
+ "type": "address",
185
+ "internalType": "address"
229
186
  }
230
187
  ],
231
- "name": "encodeRevokeWallet",
232
188
  "outputs": [
233
189
  {
234
- "internalType": "bytes",
235
190
  "name": "",
236
- "type": "bytes"
191
+ "type": "bytes",
192
+ "internalType": "bytes"
237
193
  }
238
194
  ],
239
- "stateMutability": "pure",
240
- "type": "function"
195
+ "stateMutability": "pure"
241
196
  },
242
197
  {
243
- "inputs": [
244
- {
245
- "internalType": "bytes32",
246
- "name": "roleHash",
247
- "type": "bytes32"
248
- },
198
+ "type": "function",
199
+ "name": "getFunctionSchemas",
200
+ "inputs": [],
201
+ "outputs": [
249
202
  {
203
+ "name": "",
204
+ "type": "tuple[]",
205
+ "internalType": "struct EngineBlox.FunctionSchema[]",
250
206
  "components": [
251
207
  {
252
- "internalType": "bytes4",
208
+ "name": "functionSignature",
209
+ "type": "string",
210
+ "internalType": "string"
211
+ },
212
+ {
253
213
  "name": "functionSelector",
254
- "type": "bytes4"
214
+ "type": "bytes4",
215
+ "internalType": "bytes4"
255
216
  },
256
217
  {
257
- "internalType": "uint16",
258
- "name": "grantedActionsBitmap",
259
- "type": "uint16"
218
+ "name": "operationType",
219
+ "type": "bytes32",
220
+ "internalType": "bytes32"
221
+ },
222
+ {
223
+ "name": "operationName",
224
+ "type": "string",
225
+ "internalType": "string"
226
+ },
227
+ {
228
+ "name": "supportedActionsBitmap",
229
+ "type": "uint16",
230
+ "internalType": "uint16"
231
+ },
232
+ {
233
+ "name": "enforceHandlerRelations",
234
+ "type": "bool",
235
+ "internalType": "bool"
236
+ },
237
+ {
238
+ "name": "isProtected",
239
+ "type": "bool",
240
+ "internalType": "bool"
241
+ },
242
+ {
243
+ "name": "isGrantRevocable",
244
+ "type": "bool",
245
+ "internalType": "bool"
260
246
  },
261
247
  {
262
- "internalType": "bytes4[]",
263
248
  "name": "handlerForSelectors",
264
- "type": "bytes4[]"
249
+ "type": "bytes4[]",
250
+ "internalType": "bytes4[]"
265
251
  }
266
- ],
267
- "internalType": "struct EngineBlox.FunctionPermission",
268
- "name": "functionPermission",
269
- "type": "tuple"
270
- }
271
- ],
272
- "name": "encodeAddFunctionToRole",
273
- "outputs": [
274
- {
275
- "internalType": "bytes",
276
- "name": "",
277
- "type": "bytes"
252
+ ]
278
253
  }
279
254
  ],
280
- "stateMutability": "pure",
281
- "type": "function"
255
+ "stateMutability": "pure"
282
256
  },
283
257
  {
284
- "inputs": [
258
+ "type": "function",
259
+ "name": "getRoleConfigActionSpecs",
260
+ "inputs": [],
261
+ "outputs": [
285
262
  {
286
- "internalType": "bytes32",
287
- "name": "roleHash",
288
- "type": "bytes32"
263
+ "name": "actionNames",
264
+ "type": "string[]",
265
+ "internalType": "string[]"
289
266
  },
290
267
  {
291
- "internalType": "bytes4",
292
- "name": "functionSelector",
293
- "type": "bytes4"
268
+ "name": "formats",
269
+ "type": "string[]",
270
+ "internalType": "string[]"
294
271
  }
295
272
  ],
296
- "name": "encodeRemoveFunctionFromRole",
273
+ "stateMutability": "pure"
274
+ },
275
+ {
276
+ "type": "function",
277
+ "name": "getRolePermissions",
278
+ "inputs": [],
297
279
  "outputs": [
298
280
  {
299
- "internalType": "bytes",
300
281
  "name": "",
301
- "type": "bytes"
282
+ "type": "tuple",
283
+ "internalType": "struct IDefinition.RolePermission",
284
+ "components": [
285
+ {
286
+ "name": "roleHashes",
287
+ "type": "bytes32[]",
288
+ "internalType": "bytes32[]"
289
+ },
290
+ {
291
+ "name": "functionPermissions",
292
+ "type": "tuple[]",
293
+ "internalType": "struct EngineBlox.FunctionPermission[]",
294
+ "components": [
295
+ {
296
+ "name": "functionSelector",
297
+ "type": "bytes4",
298
+ "internalType": "bytes4"
299
+ },
300
+ {
301
+ "name": "grantedActionsBitmap",
302
+ "type": "uint16",
303
+ "internalType": "uint16"
304
+ },
305
+ {
306
+ "name": "handlerForSelectors",
307
+ "type": "bytes4[]",
308
+ "internalType": "bytes4[]"
309
+ }
310
+ ]
311
+ }
312
+ ]
302
313
  }
303
314
  ],
304
- "stateMutability": "pure",
305
- "type": "function"
315
+ "stateMutability": "pure"
306
316
  },
307
317
  {
318
+ "type": "function",
319
+ "name": "roleConfigBatchExecutionParams",
308
320
  "inputs": [
309
321
  {
322
+ "name": "actions",
323
+ "type": "tuple[]",
324
+ "internalType": "struct IRuntimeRBAC.RoleConfigAction[]",
310
325
  "components": [
311
326
  {
312
- "internalType": "enum IRuntimeRBAC.RoleConfigActionType",
313
327
  "name": "actionType",
314
- "type": "IRuntimeRBAC.RoleConfigActionType"
328
+ "type": "IRuntimeRBAC.RoleConfigActionType",
329
+ "internalType": "enum IRuntimeRBAC.RoleConfigActionType"
315
330
  },
316
331
  {
317
- "internalType": "bytes",
318
332
  "name": "data",
319
- "type": "bytes"
333
+ "type": "bytes",
334
+ "internalType": "bytes"
320
335
  }
321
- ],
322
- "internalType": "struct IRuntimeRBAC.RoleConfigAction[]",
323
- "name": "actions",
324
- "type": "tuple[]"
336
+ ]
325
337
  }
326
338
  ],
327
- "name": "roleConfigBatchExecutionParams",
328
339
  "outputs": [
329
340
  {
330
- "internalType": "bytes",
331
341
  "name": "",
332
- "type": "bytes"
342
+ "type": "bytes",
343
+ "internalType": "bytes"
333
344
  }
334
345
  ],
335
- "stateMutability": "pure",
336
- "type": "function"
346
+ "stateMutability": "pure"
337
347
  },
338
348
  {
349
+ "type": "function",
350
+ "name": "roleConfigBatchExecutionParams",
339
351
  "inputs": [
340
352
  {
341
- "internalType": "bytes",
342
353
  "name": "preEncoded",
343
- "type": "bytes"
354
+ "type": "bytes",
355
+ "internalType": "bytes"
344
356
  }
345
357
  ],
346
- "name": "roleConfigBatchExecutionParams",
347
358
  "outputs": [
348
359
  {
349
- "internalType": "bytes",
350
360
  "name": "",
351
- "type": "bytes"
361
+ "type": "bytes",
362
+ "internalType": "bytes"
352
363
  }
353
364
  ],
354
- "stateMutability": "pure",
355
- "type": "function"
365
+ "stateMutability": "pure"
356
366
  },
357
367
  {
368
+ "type": "function",
369
+ "name": "supportsInterface",
358
370
  "inputs": [
359
371
  {
360
- "internalType": "bytes4",
361
372
  "name": "interfaceId",
362
- "type": "bytes4"
373
+ "type": "bytes4",
374
+ "internalType": "bytes4"
363
375
  }
364
376
  ],
365
- "name": "supportsInterface",
366
377
  "outputs": [
367
378
  {
368
- "internalType": "bool",
369
379
  "name": "",
370
- "type": "bool"
380
+ "type": "bool",
381
+ "internalType": "bool"
371
382
  }
372
383
  ],
373
- "stateMutability": "pure",
374
- "type": "function"
384
+ "stateMutability": "pure"
375
385
  }
376
386
  ]