@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,380 +1,416 @@
1
1
  [
2
2
  {
3
- "inputs": [],
3
+ "type": "function",
4
4
  "name": "APPROVE_TIMELOCK_EXECUTION_META_SELECTOR",
5
+ "inputs": [],
5
6
  "outputs": [
6
7
  {
7
- "internalType": "bytes4",
8
8
  "name": "",
9
- "type": "bytes4"
9
+ "type": "bytes4",
10
+ "internalType": "bytes4"
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": "APPROVE_TIMELOCK_EXECUTION_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": "CANCEL_TIMELOCK_EXECUTION_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": [],
42
+ "type": "function",
43
43
  "name": "CANCEL_TIMELOCK_EXECUTION_SELECTOR",
44
+ "inputs": [],
44
45
  "outputs": [
45
46
  {
46
- "internalType": "bytes4",
47
47
  "name": "",
48
- "type": "bytes4"
48
+ "type": "bytes4",
49
+ "internalType": "bytes4"
49
50
  }
50
51
  ],
51
- "stateMutability": "view",
52
- "type": "function"
52
+ "stateMutability": "view"
53
53
  },
54
54
  {
55
+ "type": "function",
56
+ "name": "CONTROLLER_CONFIG_BATCH",
55
57
  "inputs": [],
56
- "name": "CONTROLLER_OPERATION",
57
58
  "outputs": [
58
59
  {
59
- "internalType": "bytes32",
60
60
  "name": "",
61
- "type": "bytes32"
61
+ "type": "bytes32",
62
+ "internalType": "bytes32"
62
63
  }
63
64
  ],
64
- "stateMutability": "view",
65
- "type": "function"
65
+ "stateMutability": "view"
66
66
  },
67
67
  {
68
+ "type": "function",
69
+ "name": "CONTROLLER_OPERATION",
68
70
  "inputs": [],
69
- "name": "EXECUTE_WITH_TIMELOCK_SELECTOR",
70
71
  "outputs": [
71
72
  {
72
- "internalType": "bytes4",
73
73
  "name": "",
74
- "type": "bytes4"
74
+ "type": "bytes32",
75
+ "internalType": "bytes32"
75
76
  }
76
77
  ],
77
- "stateMutability": "view",
78
- "type": "function"
78
+ "stateMutability": "view"
79
79
  },
80
80
  {
81
+ "type": "function",
82
+ "name": "EXECUTE_WITH_PAYMENT_SELECTOR",
81
83
  "inputs": [],
82
- "name": "GUARD_CONFIG_BATCH_EXECUTE_SELECTOR",
83
84
  "outputs": [
84
85
  {
85
- "internalType": "bytes4",
86
86
  "name": "",
87
- "type": "bytes4"
87
+ "type": "bytes4",
88
+ "internalType": "bytes4"
88
89
  }
89
90
  ],
90
- "stateMutability": "view",
91
- "type": "function"
91
+ "stateMutability": "view"
92
92
  },
93
93
  {
94
+ "type": "function",
95
+ "name": "EXECUTE_WITH_TIMELOCK_SELECTOR",
94
96
  "inputs": [],
95
- "name": "GUARD_CONFIG_BATCH_META_SELECTOR",
96
97
  "outputs": [
97
98
  {
98
- "internalType": "bytes4",
99
99
  "name": "",
100
- "type": "bytes4"
100
+ "type": "bytes4",
101
+ "internalType": "bytes4"
101
102
  }
102
103
  ],
103
- "stateMutability": "view",
104
- "type": "function"
104
+ "stateMutability": "view"
105
105
  },
106
106
  {
107
+ "type": "function",
108
+ "name": "GUARD_CONFIG_BATCH_EXECUTE_SELECTOR",
107
109
  "inputs": [],
108
- "name": "REQUEST_AND_APPROVE_EXECUTION_SELECTOR",
109
110
  "outputs": [
110
111
  {
111
- "internalType": "bytes4",
112
112
  "name": "",
113
- "type": "bytes4"
113
+ "type": "bytes4",
114
+ "internalType": "bytes4"
114
115
  }
115
116
  ],
116
- "stateMutability": "view",
117
- "type": "function"
117
+ "stateMutability": "view"
118
118
  },
119
119
  {
120
+ "type": "function",
121
+ "name": "GUARD_CONFIG_BATCH_META_SELECTOR",
120
122
  "inputs": [],
121
- "name": "getFunctionSchemas",
122
123
  "outputs": [
123
124
  {
124
- "components": [
125
- {
126
- "internalType": "string",
127
- "name": "functionSignature",
128
- "type": "string"
129
- },
130
- {
131
- "internalType": "bytes4",
132
- "name": "functionSelector",
133
- "type": "bytes4"
134
- },
135
- {
136
- "internalType": "bytes32",
137
- "name": "operationType",
138
- "type": "bytes32"
139
- },
140
- {
141
- "internalType": "string",
142
- "name": "operationName",
143
- "type": "string"
144
- },
145
- {
146
- "internalType": "uint16",
147
- "name": "supportedActionsBitmap",
148
- "type": "uint16"
149
- },
150
- {
151
- "internalType": "bool",
152
- "name": "isProtected",
153
- "type": "bool"
154
- },
155
- {
156
- "internalType": "bytes4[]",
157
- "name": "handlerForSelectors",
158
- "type": "bytes4[]"
159
- }
160
- ],
161
- "internalType": "struct EngineBlox.FunctionSchema[]",
162
125
  "name": "",
163
- "type": "tuple[]"
126
+ "type": "bytes4",
127
+ "internalType": "bytes4"
164
128
  }
165
129
  ],
166
- "stateMutability": "pure",
167
- "type": "function"
130
+ "stateMutability": "view"
168
131
  },
169
132
  {
133
+ "type": "function",
134
+ "name": "REQUEST_AND_APPROVE_EXECUTION_SELECTOR",
170
135
  "inputs": [],
171
- "name": "getRolePermissions",
172
136
  "outputs": [
173
137
  {
174
- "components": [
175
- {
176
- "internalType": "bytes32[]",
177
- "name": "roleHashes",
178
- "type": "bytes32[]"
179
- },
180
- {
181
- "components": [
182
- {
183
- "internalType": "bytes4",
184
- "name": "functionSelector",
185
- "type": "bytes4"
186
- },
187
- {
188
- "internalType": "uint16",
189
- "name": "grantedActionsBitmap",
190
- "type": "uint16"
191
- },
192
- {
193
- "internalType": "bytes4[]",
194
- "name": "handlerForSelectors",
195
- "type": "bytes4[]"
196
- }
197
- ],
198
- "internalType": "struct EngineBlox.FunctionPermission[]",
199
- "name": "functionPermissions",
200
- "type": "tuple[]"
201
- }
202
- ],
203
- "internalType": "struct IDefinition.RolePermission",
204
138
  "name": "",
205
- "type": "tuple"
139
+ "type": "bytes4",
140
+ "internalType": "bytes4"
206
141
  }
207
142
  ],
208
- "stateMutability": "pure",
209
- "type": "function"
143
+ "stateMutability": "view"
210
144
  },
211
145
  {
212
- "inputs": [],
213
- "name": "getGuardConfigActionSpecs",
214
- "outputs": [
146
+ "type": "function",
147
+ "name": "encodeAddTargetToWhitelist",
148
+ "inputs": [
215
149
  {
216
- "internalType": "string[]",
217
- "name": "actionNames",
218
- "type": "string[]"
150
+ "name": "functionSelector",
151
+ "type": "bytes4",
152
+ "internalType": "bytes4"
219
153
  },
220
154
  {
221
- "internalType": "string[]",
222
- "name": "formats",
223
- "type": "string[]"
155
+ "name": "target",
156
+ "type": "address",
157
+ "internalType": "address"
224
158
  }
225
159
  ],
226
- "stateMutability": "pure",
227
- "type": "function"
160
+ "outputs": [
161
+ {
162
+ "name": "",
163
+ "type": "bytes",
164
+ "internalType": "bytes"
165
+ }
166
+ ],
167
+ "stateMutability": "pure"
228
168
  },
229
169
  {
170
+ "type": "function",
171
+ "name": "encodeRegisterFunction",
230
172
  "inputs": [
231
173
  {
232
- "internalType": "bytes4",
233
- "name": "functionSelector",
234
- "type": "bytes4"
174
+ "name": "functionSignature",
175
+ "type": "string",
176
+ "internalType": "string"
235
177
  },
236
178
  {
237
- "internalType": "address",
238
- "name": "target",
239
- "type": "address"
179
+ "name": "operationName",
180
+ "type": "string",
181
+ "internalType": "string"
182
+ },
183
+ {
184
+ "name": "supportedActions",
185
+ "type": "EngineBlox.TxAction[]",
186
+ "internalType": "enum EngineBlox.TxAction[]"
240
187
  }
241
188
  ],
242
- "name": "encodeAddTargetToWhitelist",
243
189
  "outputs": [
244
190
  {
245
- "internalType": "bytes",
246
191
  "name": "",
247
- "type": "bytes"
192
+ "type": "bytes",
193
+ "internalType": "bytes"
248
194
  }
249
195
  ],
250
- "stateMutability": "pure",
251
- "type": "function"
196
+ "stateMutability": "pure"
252
197
  },
253
198
  {
199
+ "type": "function",
200
+ "name": "encodeRemoveTargetFromWhitelist",
254
201
  "inputs": [
255
202
  {
256
- "internalType": "bytes4",
257
203
  "name": "functionSelector",
258
- "type": "bytes4"
204
+ "type": "bytes4",
205
+ "internalType": "bytes4"
259
206
  },
260
207
  {
261
- "internalType": "address",
262
208
  "name": "target",
263
- "type": "address"
209
+ "type": "address",
210
+ "internalType": "address"
264
211
  }
265
212
  ],
266
- "name": "encodeRemoveTargetFromWhitelist",
267
213
  "outputs": [
268
214
  {
269
- "internalType": "bytes",
270
215
  "name": "",
271
- "type": "bytes"
216
+ "type": "bytes",
217
+ "internalType": "bytes"
272
218
  }
273
219
  ],
274
- "stateMutability": "pure",
275
- "type": "function"
220
+ "stateMutability": "pure"
276
221
  },
277
222
  {
223
+ "type": "function",
224
+ "name": "encodeUnregisterFunction",
278
225
  "inputs": [
279
226
  {
280
- "internalType": "string",
281
- "name": "functionSignature",
282
- "type": "string"
227
+ "name": "functionSelector",
228
+ "type": "bytes4",
229
+ "internalType": "bytes4"
283
230
  },
284
231
  {
285
- "internalType": "string",
286
- "name": "operationName",
287
- "type": "string"
288
- },
232
+ "name": "safeRemoval",
233
+ "type": "bool",
234
+ "internalType": "bool"
235
+ }
236
+ ],
237
+ "outputs": [
289
238
  {
290
- "internalType": "enum EngineBlox.TxAction[]",
291
- "name": "supportedActions",
292
- "type": "EngineBlox.TxAction[]"
239
+ "name": "",
240
+ "type": "bytes",
241
+ "internalType": "bytes"
293
242
  }
294
243
  ],
295
- "name": "encodeRegisterFunction",
244
+ "stateMutability": "pure"
245
+ },
246
+ {
247
+ "type": "function",
248
+ "name": "getFunctionSchemas",
249
+ "inputs": [],
296
250
  "outputs": [
297
251
  {
298
- "internalType": "bytes",
299
252
  "name": "",
300
- "type": "bytes"
253
+ "type": "tuple[]",
254
+ "internalType": "struct EngineBlox.FunctionSchema[]",
255
+ "components": [
256
+ {
257
+ "name": "functionSignature",
258
+ "type": "string",
259
+ "internalType": "string"
260
+ },
261
+ {
262
+ "name": "functionSelector",
263
+ "type": "bytes4",
264
+ "internalType": "bytes4"
265
+ },
266
+ {
267
+ "name": "operationType",
268
+ "type": "bytes32",
269
+ "internalType": "bytes32"
270
+ },
271
+ {
272
+ "name": "operationName",
273
+ "type": "string",
274
+ "internalType": "string"
275
+ },
276
+ {
277
+ "name": "supportedActionsBitmap",
278
+ "type": "uint16",
279
+ "internalType": "uint16"
280
+ },
281
+ {
282
+ "name": "enforceHandlerRelations",
283
+ "type": "bool",
284
+ "internalType": "bool"
285
+ },
286
+ {
287
+ "name": "isProtected",
288
+ "type": "bool",
289
+ "internalType": "bool"
290
+ },
291
+ {
292
+ "name": "isGrantRevocable",
293
+ "type": "bool",
294
+ "internalType": "bool"
295
+ },
296
+ {
297
+ "name": "handlerForSelectors",
298
+ "type": "bytes4[]",
299
+ "internalType": "bytes4[]"
300
+ }
301
+ ]
301
302
  }
302
303
  ],
303
- "stateMutability": "pure",
304
- "type": "function"
304
+ "stateMutability": "pure"
305
305
  },
306
306
  {
307
- "inputs": [
307
+ "type": "function",
308
+ "name": "getGuardConfigActionSpecs",
309
+ "inputs": [],
310
+ "outputs": [
308
311
  {
309
- "internalType": "bytes4",
310
- "name": "functionSelector",
311
- "type": "bytes4"
312
+ "name": "actionNames",
313
+ "type": "string[]",
314
+ "internalType": "string[]"
312
315
  },
313
316
  {
314
- "internalType": "bool",
315
- "name": "safeRemoval",
316
- "type": "bool"
317
+ "name": "formats",
318
+ "type": "string[]",
319
+ "internalType": "string[]"
317
320
  }
318
321
  ],
319
- "name": "encodeUnregisterFunction",
322
+ "stateMutability": "pure"
323
+ },
324
+ {
325
+ "type": "function",
326
+ "name": "getRolePermissions",
327
+ "inputs": [],
320
328
  "outputs": [
321
329
  {
322
- "internalType": "bytes",
323
330
  "name": "",
324
- "type": "bytes"
331
+ "type": "tuple",
332
+ "internalType": "struct IDefinition.RolePermission",
333
+ "components": [
334
+ {
335
+ "name": "roleHashes",
336
+ "type": "bytes32[]",
337
+ "internalType": "bytes32[]"
338
+ },
339
+ {
340
+ "name": "functionPermissions",
341
+ "type": "tuple[]",
342
+ "internalType": "struct EngineBlox.FunctionPermission[]",
343
+ "components": [
344
+ {
345
+ "name": "functionSelector",
346
+ "type": "bytes4",
347
+ "internalType": "bytes4"
348
+ },
349
+ {
350
+ "name": "grantedActionsBitmap",
351
+ "type": "uint16",
352
+ "internalType": "uint16"
353
+ },
354
+ {
355
+ "name": "handlerForSelectors",
356
+ "type": "bytes4[]",
357
+ "internalType": "bytes4[]"
358
+ }
359
+ ]
360
+ }
361
+ ]
325
362
  }
326
363
  ],
327
- "stateMutability": "pure",
328
- "type": "function"
364
+ "stateMutability": "pure"
329
365
  },
330
366
  {
367
+ "type": "function",
368
+ "name": "guardConfigBatchExecutionParams",
331
369
  "inputs": [
332
370
  {
371
+ "name": "actions",
372
+ "type": "tuple[]",
373
+ "internalType": "struct IGuardController.GuardConfigAction[]",
333
374
  "components": [
334
375
  {
335
- "internalType": "enum IGuardController.GuardConfigActionType",
336
376
  "name": "actionType",
337
- "type": "IGuardController.GuardConfigActionType"
377
+ "type": "IGuardController.GuardConfigActionType",
378
+ "internalType": "enum IGuardController.GuardConfigActionType"
338
379
  },
339
380
  {
340
- "internalType": "bytes",
341
381
  "name": "data",
342
- "type": "bytes"
382
+ "type": "bytes",
383
+ "internalType": "bytes"
343
384
  }
344
- ],
345
- "internalType": "struct IGuardController.GuardConfigAction[]",
346
- "name": "actions",
347
- "type": "tuple[]"
385
+ ]
348
386
  }
349
387
  ],
350
- "name": "guardConfigBatchExecutionParams",
351
388
  "outputs": [
352
389
  {
353
- "internalType": "bytes",
354
390
  "name": "",
355
- "type": "bytes"
391
+ "type": "bytes",
392
+ "internalType": "bytes"
356
393
  }
357
394
  ],
358
- "stateMutability": "pure",
359
- "type": "function"
395
+ "stateMutability": "pure"
360
396
  },
361
397
  {
398
+ "type": "function",
399
+ "name": "supportsInterface",
362
400
  "inputs": [
363
401
  {
364
- "internalType": "bytes4",
365
402
  "name": "interfaceId",
366
- "type": "bytes4"
403
+ "type": "bytes4",
404
+ "internalType": "bytes4"
367
405
  }
368
406
  ],
369
- "name": "supportsInterface",
370
407
  "outputs": [
371
408
  {
372
- "internalType": "bool",
373
409
  "name": "",
374
- "type": "bool"
410
+ "type": "bool",
411
+ "internalType": "bool"
375
412
  }
376
413
  ],
377
- "stateMutability": "pure",
378
- "type": "function"
414
+ "stateMutability": "pure"
379
415
  }
380
416
  ]