@bloxchain/contracts 1.0.0-alpha.20 → 1.0.0-alpha.21

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.
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  // OpenZeppelin imports
5
5
  import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
@@ -524,7 +524,7 @@ abstract contract BaseStateMachine is Initializable, ERC165Upgradeable, Reentran
524
524
  /**
525
525
  * @dev Gets function schema information
526
526
  * @param functionSelector The function selector to get information for
527
- * @return The full FunctionSchema struct (functionSignature, functionSelector, operationType, operationName, supportedActionsBitmap, enforceHandlerRelations, isProtected, handlerForSelectors)
527
+ * @return The full FunctionSchema struct (functionSignature, functionSelector, operationType, operationName, supportedActionsBitmap, enforceHandlerRelations, isProtected, isGrantRevocable, handlerForSelectors)
528
528
  * @notice Reverts with ResourceNotFound if the schema does not exist
529
529
  */
530
530
  function getFunctionSchema(bytes4 functionSelector) external view returns (EngineBlox.FunctionSchema memory) {
@@ -701,7 +701,8 @@ abstract contract BaseStateMachine is Initializable, ERC165Upgradeable, Reentran
701
701
  * @param operationName The operation name
702
702
  * @param supportedActionsBitmap The bitmap of supported actions
703
703
  * @param enforceHandlerRelations Whether to enforce strict handler/schema alignment
704
- * @param isProtected Whether the function schema is protected
704
+ * @param isProtected Whether the function schema is protected from unregister
705
+ * @param isGrantRevocable Whether role grants for this schema may be removed via `removeFunctionFromRole` (any role, including protected roles, when true)
705
706
  * @param handlerForSelectors Array of handler selectors
706
707
  * @notice This function is virtual to allow extensions to add hook functionality
707
708
  */
@@ -712,6 +713,7 @@ abstract contract BaseStateMachine is Initializable, ERC165Upgradeable, Reentran
712
713
  uint16 supportedActionsBitmap,
713
714
  bool enforceHandlerRelations,
714
715
  bool isProtected,
716
+ bool isGrantRevocable,
715
717
  bytes4[] memory handlerForSelectors
716
718
  ) internal virtual {
717
719
  EngineBlox.registerFunction(
@@ -722,6 +724,7 @@ abstract contract BaseStateMachine is Initializable, ERC165Upgradeable, Reentran
722
724
  supportedActionsBitmap,
723
725
  enforceHandlerRelations,
724
726
  isProtected,
727
+ isGrantRevocable,
725
728
  handlerForSelectors
726
729
  );
727
730
  }
@@ -909,6 +912,7 @@ abstract contract BaseStateMachine is Initializable, ERC165Upgradeable, Reentran
909
912
  functionSchemas[i].supportedActionsBitmap,
910
913
  functionSchemas[i].enforceHandlerRelations,
911
914
  functionSchemas[i].isProtected,
915
+ functionSchemas[i].isGrantRevocable,
912
916
  functionSchemas[i].handlerForSelectors
913
917
  );
914
918
  }
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  // Contracts imports
5
5
  import "../../lib/EngineBlox.sol";
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  import "../base/BaseStateMachine.sol";
5
5
  import "../lib/utils/SharedValidation.sol";
@@ -447,6 +447,7 @@ abstract contract GuardController is BaseStateMachine {
447
447
  supportedActionsBitmap,
448
448
  true, // enforceHandlerRelations for dynamically registered execution selectors
449
449
  false, // isProtected = false for dynamically registered functions
450
+ true, // isGrantRevocable: dynamically registered schemas may be revoked from roles
450
451
  executionHandlers // handlerForSelectors with self-reference for execution selectors
451
452
  );
452
453
  }
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  import "../../lib/EngineBlox.sol";
5
5
 
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
5
  import "../../../lib/EngineBlox.sol";
@@ -53,28 +53,28 @@ library GuardControllerDefinitions {
53
53
  // GuardController: approveTimeLockExecutionWithMetaTx(EngineBlox.MetaTransaction)
54
54
  bytes4 public constant APPROVE_TIMELOCK_EXECUTION_META_SELECTOR = bytes4(
55
55
  keccak256(
56
- "approveTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
56
+ "approveTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
57
57
  )
58
58
  );
59
59
 
60
60
  // GuardController: cancelTimeLockExecutionWithMetaTx(EngineBlox.MetaTransaction)
61
61
  bytes4 public constant CANCEL_TIMELOCK_EXECUTION_META_SELECTOR = bytes4(
62
62
  keccak256(
63
- "cancelTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
63
+ "cancelTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
64
64
  )
65
65
  );
66
66
 
67
67
  // GuardController: requestAndApproveExecution(EngineBlox.MetaTransaction)
68
68
  bytes4 public constant REQUEST_AND_APPROVE_EXECUTION_SELECTOR = bytes4(
69
69
  keccak256(
70
- "requestAndApproveExecution(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
70
+ "requestAndApproveExecution(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
71
71
  )
72
72
  );
73
73
 
74
74
  // GuardController: guardConfigBatchRequestAndApprove(...)
75
75
  bytes4 public constant GUARD_CONFIG_BATCH_META_SELECTOR = bytes4(
76
76
  keccak256(
77
- "guardConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
77
+ "guardConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
78
78
  )
79
79
  );
80
80
 
@@ -163,6 +163,7 @@ library GuardControllerDefinitions {
163
163
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayRequestActions),
164
164
  enforceHandlerRelations: false,
165
165
  isProtected: true,
166
+ isGrantRevocable: false,
166
167
  handlerForSelectors: executeWithTimeLockHandlerForSelectors
167
168
  });
168
169
 
@@ -175,6 +176,7 @@ library GuardControllerDefinitions {
175
176
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayApproveActions),
176
177
  enforceHandlerRelations: false,
177
178
  isProtected: true,
179
+ isGrantRevocable: false,
178
180
  handlerForSelectors: approveTimeLockExecutionHandlerForSelectors
179
181
  });
180
182
 
@@ -187,54 +189,59 @@ library GuardControllerDefinitions {
187
189
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayCancelActions),
188
190
  enforceHandlerRelations: false,
189
191
  isProtected: true,
192
+ isGrantRevocable: false,
190
193
  handlerForSelectors: cancelTimeLockExecutionHandlerForSelectors
191
194
  });
192
195
 
193
196
  // Schema 3: GuardController.approveTimeLockExecutionWithMetaTx
194
197
  schemas[3] = EngineBlox.FunctionSchema({
195
- functionSignature: "approveTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
198
+ functionSignature: "approveTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
196
199
  functionSelector: APPROVE_TIMELOCK_EXECUTION_META_SELECTOR,
197
200
  operationType: CONTROLLER_OPERATION,
198
201
  operationName: "CONTROLLER_OPERATION",
199
202
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaTxApproveActions),
200
203
  enforceHandlerRelations: false,
201
204
  isProtected: true,
205
+ isGrantRevocable: false,
202
206
  handlerForSelectors: approveTimeLockExecutionMetaHandlerForSelectors
203
207
  });
204
208
 
205
209
  // Schema 4: GuardController.cancelTimeLockExecutionWithMetaTx
206
210
  schemas[4] = EngineBlox.FunctionSchema({
207
- functionSignature: "cancelTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
211
+ functionSignature: "cancelTimeLockExecutionWithMetaTx(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
208
212
  functionSelector: CANCEL_TIMELOCK_EXECUTION_META_SELECTOR,
209
213
  operationType: CONTROLLER_OPERATION,
210
214
  operationName: "CONTROLLER_OPERATION",
211
215
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaTxCancelActions),
212
216
  enforceHandlerRelations: false,
213
217
  isProtected: true,
218
+ isGrantRevocable: false,
214
219
  handlerForSelectors: cancelTimeLockExecutionMetaHandlerForSelectors
215
220
  });
216
221
 
217
222
  // Schema 5: GuardController.requestAndApproveExecution
218
223
  schemas[5] = EngineBlox.FunctionSchema({
219
- functionSignature: "requestAndApproveExecution(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
224
+ functionSignature: "requestAndApproveExecution(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
220
225
  functionSelector: REQUEST_AND_APPROVE_EXECUTION_SELECTOR,
221
226
  operationType: CONTROLLER_OPERATION,
222
227
  operationName: "CONTROLLER_OPERATION",
223
228
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaTxRequestApproveActions),
224
229
  enforceHandlerRelations: false,
225
230
  isProtected: true,
231
+ isGrantRevocable: false,
226
232
  handlerForSelectors: requestAndApproveExecutionHandlerForSelectors
227
233
  });
228
234
 
229
235
  // Schema 6: GuardController.guardConfigBatchRequestAndApprove
230
236
  schemas[6] = EngineBlox.FunctionSchema({
231
- functionSignature: "guardConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
237
+ functionSignature: "guardConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
232
238
  functionSelector: GUARD_CONFIG_BATCH_META_SELECTOR,
233
239
  operationType: CONTROLLER_CONFIG_BATCH,
234
240
  operationName: "CONTROLLER_CONFIG_BATCH",
235
241
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaTxRequestApproveActions),
236
242
  enforceHandlerRelations: true,
237
243
  isProtected: true,
244
+ isGrantRevocable: false,
238
245
  handlerForSelectors: guardConfigHandlerForSelectors
239
246
  });
240
247
 
@@ -251,6 +258,7 @@ library GuardControllerDefinitions {
251
258
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(guardConfigExecutionActions),
252
259
  enforceHandlerRelations: false,
253
260
  isProtected: true,
261
+ isGrantRevocable: false,
254
262
  handlerForSelectors: guardConfigBatchExecuteHandlerForSelectors
255
263
  });
256
264
 
@@ -269,6 +277,7 @@ library GuardControllerDefinitions {
269
277
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayRequestActions),
270
278
  enforceHandlerRelations: false,
271
279
  isProtected: true,
280
+ isGrantRevocable: false,
272
281
  handlerForSelectors: executeWithPaymentHandlerForSelectors
273
282
  });
274
283
 
@@ -295,6 +304,7 @@ library GuardControllerDefinitions {
295
304
  supportedActionsBitmap: allActionsBitmap,
296
305
  enforceHandlerRelations: false,
297
306
  isProtected: true,
307
+ isGrantRevocable: true,
298
308
  handlerForSelectors: attachedPaymentRecipientHandlers
299
309
  });
300
310
 
@@ -308,6 +318,7 @@ library GuardControllerDefinitions {
308
318
  supportedActionsBitmap: allActionsBitmap,
309
319
  enforceHandlerRelations: false,
310
320
  isProtected: true,
321
+ isGrantRevocable: true,
311
322
  handlerForSelectors: nativeTransferHandlers
312
323
  });
313
324
 
@@ -321,6 +332,7 @@ library GuardControllerDefinitions {
321
332
  supportedActionsBitmap: allActionsBitmap,
322
333
  enforceHandlerRelations: false,
323
334
  isProtected: true,
335
+ isGrantRevocable: true,
324
336
  handlerForSelectors: erc20TransferHandlers
325
337
  });
326
338