@bloxchain/contracts 1.0.0-alpha.2 → 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.
Files changed (43) hide show
  1. package/README.md +7 -7
  2. package/abi/BaseStateMachine.abi.json +798 -753
  3. package/abi/EngineBlox.abi.json +566 -576
  4. package/abi/GuardController.abi.json +1546 -2095
  5. package/abi/GuardControllerDefinitions.abi.json +416 -0
  6. package/abi/IDefinition.abi.json +57 -47
  7. package/abi/RuntimeRBAC.abi.json +901 -959
  8. package/abi/RuntimeRBACDefinitions.abi.json +265 -81
  9. package/abi/SecureOwnable.abi.json +1522 -2581
  10. package/abi/SecureOwnableDefinitions.abi.json +174 -164
  11. package/components/README.md +8 -0
  12. package/core/access/RuntimeRBAC.sol +253 -270
  13. package/core/access/interface/IRuntimeRBAC.sol +55 -84
  14. package/core/access/lib/definitions/RuntimeRBACDefinitions.sol +97 -4
  15. package/core/base/BaseStateMachine.sol +198 -108
  16. package/core/base/interface/IBaseStateMachine.sol +153 -153
  17. package/core/execution/GuardController.sol +156 -131
  18. package/core/execution/interface/IGuardController.sol +146 -120
  19. package/core/execution/lib/definitions/GuardControllerDefinitions.sol +207 -45
  20. package/core/lib/EngineBlox.sol +2636 -2322
  21. package/{interfaces → core/lib/interfaces}/IDefinition.sol +49 -49
  22. package/{interfaces → core/lib/interfaces}/IEventForwarder.sol +5 -3
  23. package/{utils → core/lib/utils}/SharedValidation.sol +69 -22
  24. package/core/pattern/Account.sol +84 -0
  25. package/core/security/SecureOwnable.sol +180 -146
  26. package/core/security/interface/ISecureOwnable.sol +105 -104
  27. package/core/security/lib/definitions/SecureOwnableDefinitions.sol +818 -786
  28. package/package.json +5 -5
  29. package/standards/README.md +12 -0
  30. package/standards/behavior/ICopyable.sol +34 -0
  31. package/standards/hooks/IOnActionHook.sol +21 -0
  32. package/abi/AccountBlox.abi.json +0 -5799
  33. package/abi/BareBlox.abi.json +0 -1284
  34. package/abi/RoleBlox.abi.json +0 -4209
  35. package/abi/SecureBlox.abi.json +0 -3828
  36. package/abi/SimpleRWA20.abi.json +0 -5288
  37. package/abi/SimpleRWA20Definitions.abi.json +0 -191
  38. package/abi/SimpleVault.abi.json +0 -4951
  39. package/abi/SimpleVaultDefinitions.abi.json +0 -269
  40. package/core/research/BloxchainWallet.sol +0 -306
  41. package/core/research/erc20-blox/ERC20Blox.sol +0 -140
  42. package/core/research/erc20-blox/lib/definitions/ERC20BloxDefinitions.sol +0 -185
  43. package/interfaces/IOnActionHook.sol +0 -79
@@ -1,120 +1,146 @@
1
- // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.33;
3
-
4
- import "../../lib/EngineBlox.sol";
5
-
6
- /**
7
- * @title IGuardController
8
- * @dev Interface for GuardController contract that GuardianSafeV3 and other contracts delegate to
9
- * @notice This interface defines only GuardController-specific methods
10
- * @notice Functions from BaseStateMachine (createMetaTxParams, generateUnsignedMetaTransaction*, getTransaction, functionSchemaExists, owner, getBroadcaster, getRecovery) should be accessed via IBaseStateMachine
11
- * @notice Functions from RuntimeRBAC (registerFunction, unregisterFunction, getFunctionSchema, createNewRole, addWalletToRole, revokeWallet) should be accessed via IRuntimeRBAC
12
- * @custom:security-contact security@particlecrypto.com
13
- */
14
- interface IGuardController {
15
- /**
16
- * @notice Initializer to initialize GuardController
17
- * @param initialOwner The initial owner address
18
- * @param broadcaster The broadcaster address
19
- * @param recovery The recovery address
20
- * @param timeLockPeriodSec The timelock period in seconds
21
- * @param eventForwarder The event forwarder address
22
- */
23
- function initialize(
24
- address initialOwner,
25
- address broadcaster,
26
- address recovery,
27
- uint256 timeLockPeriodSec,
28
- address eventForwarder
29
- ) external;
30
-
31
- /**
32
- * @dev Requests a time-locked execution via EngineBlox workflow
33
- * @param target The address of the target contract
34
- * @param value The ETH value to send (0 for standard function calls)
35
- * @param functionSelector The function selector to execute (0x00000000 for simple ETH transfers)
36
- * @param params The encoded parameters for the function (empty for simple ETH transfers)
37
- * @param gasLimit The gas limit for execution
38
- * @param operationType The operation type hash
39
- * @return txId The transaction ID for the requested operation
40
- * @notice Creates a time-locked transaction that must be approved after the timelock period
41
- * @notice Requires EXECUTE_TIME_DELAY_REQUEST permission for the function selector
42
- * @notice For standard function calls: value=0, functionSelector=non-zero, params=encoded data
43
- * @notice For simple ETH transfers: value>0, functionSelector=0x00000000, params=""
44
- */
45
- function executeWithTimeLock(
46
- address target,
47
- uint256 value,
48
- bytes4 functionSelector,
49
- bytes memory params,
50
- uint256 gasLimit,
51
- bytes32 operationType
52
- ) external returns (uint256 txId);
53
-
54
- /**
55
- * @dev Approves and executes a time-locked transaction
56
- * @param txId The transaction ID
57
- * @param expectedOperationType The expected operation type for validation
58
- * @return result The execution result
59
- * @notice Requires STANDARD execution type and EXECUTE_TIME_DELAY_APPROVE permission for the execution function
60
- */
61
- function approveTimeLockExecution(
62
- uint256 txId,
63
- bytes32 expectedOperationType
64
- ) external returns (bytes memory result);
65
-
66
- /**
67
- * @dev Cancels a time-locked transaction
68
- * @param txId The transaction ID
69
- * @param expectedOperationType The expected operation type for validation
70
- * @return The updated transaction record
71
- * @notice Requires STANDARD execution type and EXECUTE_TIME_DELAY_CANCEL permission for the execution function
72
- */
73
- function cancelTimeLockExecution(
74
- uint256 txId,
75
- bytes32 expectedOperationType
76
- ) external returns (EngineBlox.TxRecord memory);
77
-
78
- /**
79
- * @dev Approves a time-locked transaction using a meta-transaction
80
- * @param metaTx The meta-transaction containing the transaction record and signature
81
- * @param expectedOperationType The expected operation type for validation
82
- * @param requiredSelector The handler selector for validation
83
- * @return The updated transaction record
84
- * @notice Requires STANDARD execution type and EXECUTE_META_APPROVE permission for the execution function
85
- */
86
- function approveTimeLockExecutionWithMetaTx(
87
- EngineBlox.MetaTransaction memory metaTx,
88
- bytes32 expectedOperationType,
89
- bytes4 requiredSelector
90
- ) external returns (EngineBlox.TxRecord memory);
91
-
92
- /**
93
- * @dev Cancels a time-locked transaction using a meta-transaction
94
- * @param metaTx The meta-transaction containing the transaction record and signature
95
- * @param expectedOperationType The expected operation type for validation
96
- * @param requiredSelector The handler selector for validation
97
- * @return The updated transaction record
98
- * @notice Requires STANDARD execution type and EXECUTE_META_CANCEL permission for the execution function
99
- */
100
- function cancelTimeLockExecutionWithMetaTx(
101
- EngineBlox.MetaTransaction memory metaTx,
102
- bytes32 expectedOperationType,
103
- bytes4 requiredSelector
104
- ) external returns (EngineBlox.TxRecord memory);
105
-
106
- /**
107
- * @dev Requests and approves a transaction in one step using a meta-transaction
108
- * @param metaTx The meta-transaction containing the transaction record and signature
109
- * @param requiredSelector The handler selector for validation
110
- * @return The transaction record after request and approval
111
- * @notice Requires STANDARD execution type
112
- * @notice Validates function schema and permissions for the execution function (same as executeWithTimeLock)
113
- * @notice Requires EXECUTE_META_REQUEST_AND_APPROVE permission for the execution function selector
114
- */
115
- function requestAndApproveExecution(
116
- EngineBlox.MetaTransaction memory metaTx,
117
- bytes4 requiredSelector
118
- ) external returns (EngineBlox.TxRecord memory);
119
- }
120
-
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ pragma solidity 0.8.35;
3
+
4
+ import "../../lib/EngineBlox.sol";
5
+
6
+ /**
7
+ * @title IGuardController
8
+ * @dev Interface for GuardController contract that AccountBlox and other contracts delegate to
9
+ * @notice This interface defines only GuardController-specific methods
10
+ * @notice Functions from BaseStateMachine (createMetaTxParams, generateUnsignedMetaTransaction*, getTransaction, getFunctionSchema, owner, getBroadcasters, getRecovery) should be accessed via IBaseStateMachine
11
+ * @notice Functions from RuntimeRBAC (role management: createNewRole, addWalletToRole, revokeWallet, etc.) should be accessed via IRuntimeRBAC. Function schema registration is performed via GuardController (guard config batch), not RuntimeRBAC.
12
+ * @custom:security-contact security@particlecrypto.com
13
+ */
14
+ interface IGuardController {
15
+ /**
16
+ * @dev Action types for batched Guard configuration
17
+ */
18
+ enum GuardConfigActionType {
19
+ ADD_TARGET_TO_WHITELIST,
20
+ REMOVE_TARGET_FROM_WHITELIST,
21
+ REGISTER_FUNCTION,
22
+ UNREGISTER_FUNCTION
23
+ }
24
+
25
+ /**
26
+ * @dev Encodes a single Guard configuration action in a batch
27
+ */
28
+ struct GuardConfigAction {
29
+ GuardConfigActionType actionType;
30
+ bytes data;
31
+ }
32
+
33
+ /**
34
+ * @notice Initializer to initialize GuardController
35
+ * @param initialOwner The initial owner address
36
+ * @param broadcaster The broadcaster address
37
+ * @param recovery The recovery address
38
+ * @param timeLockPeriodSec The timelock period in seconds
39
+ * @param eventForwarder The event forwarder address
40
+ */
41
+ function initialize(
42
+ address initialOwner,
43
+ address broadcaster,
44
+ address recovery,
45
+ uint256 timeLockPeriodSec,
46
+ address eventForwarder
47
+ ) external;
48
+
49
+ /**
50
+ * @dev Requests a time-locked execution via EngineBlox workflow
51
+ * @param target The address of the target contract
52
+ * @param value The ETH value to send (0 for standard function calls)
53
+ * @param functionSelector The function selector to execute (0x00000000 for simple ETH transfers)
54
+ * @param params The encoded parameters for the function (empty for simple ETH transfers)
55
+ * @param gasLimit The gas limit for execution
56
+ * @param operationType The operation type hash
57
+ * @return txId The transaction ID for the requested operation
58
+ * @notice Creates a time-locked transaction that must be approved after the timelock period
59
+ * @notice Requires EXECUTE_TIME_DELAY_REQUEST permission for the function selector
60
+ * @notice For standard function calls: value=0, functionSelector=non-zero, params=encoded data
61
+ * @notice For simple ETH transfers: value>0, functionSelector=0x00000000, params=""
62
+ */
63
+ function executeWithTimeLock(
64
+ address target,
65
+ uint256 value,
66
+ bytes4 functionSelector,
67
+ bytes memory params,
68
+ uint256 gasLimit,
69
+ bytes32 operationType
70
+ ) external returns (uint256 txId);
71
+
72
+ /**
73
+ * @dev Requests a time-locked execution with payment details attached (same permissions as executeWithTimeLock)
74
+ * @param target The address of the target contract
75
+ * @param value The ETH value to send (0 for standard function calls)
76
+ * @param functionSelector The function selector to execute (NATIVE_TRANSFER_SELECTOR for simple native token transfers)
77
+ * @param params The encoded parameters for the function (empty for simple native token transfers)
78
+ * @param gasLimit The gas limit for execution
79
+ * @param operationType The operation type hash
80
+ * @param paymentDetails The payment details to attach to the transaction
81
+ * @return txId The transaction ID for the requested operation (use getTransaction(txId) for full record)
82
+ * @notice Reuses EXECUTE_TIME_DELAY_REQUEST permission; approval/cancel same as executeWithTimeLock
83
+ */
84
+ function executeWithPayment(
85
+ address target,
86
+ uint256 value,
87
+ bytes4 functionSelector,
88
+ bytes memory params,
89
+ uint256 gasLimit,
90
+ bytes32 operationType,
91
+ EngineBlox.PaymentDetails memory paymentDetails
92
+ ) external returns (uint256 txId);
93
+
94
+ /**
95
+ * @dev Approves and executes a time-locked transaction
96
+ * @param txId The transaction ID
97
+ * @return txId The transaction ID (use getTransaction(txId) for full record and result)
98
+ * @notice Requires STANDARD execution type and EXECUTE_TIME_DELAY_APPROVE permission for the execution function
99
+ */
100
+ function approveTimeLockExecution(
101
+ uint256 txId
102
+ ) external returns (uint256);
103
+
104
+ /**
105
+ * @dev Cancels a time-locked transaction
106
+ * @param txId The transaction ID
107
+ * @return txId The transaction ID (use getTransaction(txId) for full record)
108
+ * @notice Requires STANDARD execution type and EXECUTE_TIME_DELAY_CANCEL permission for the execution function
109
+ */
110
+ function cancelTimeLockExecution(
111
+ uint256 txId
112
+ ) external returns (uint256);
113
+
114
+ /**
115
+ * @dev Approves a time-locked transaction using a meta-transaction
116
+ * @param metaTx The meta-transaction containing the transaction record and signature
117
+ * @return The transaction ID (use getTransaction(txId) for full record)
118
+ * @notice Requires STANDARD execution type and EXECUTE_META_APPROVE permission for the execution function
119
+ */
120
+ function approveTimeLockExecutionWithMetaTx(
121
+ EngineBlox.MetaTransaction memory metaTx
122
+ ) external returns (uint256);
123
+
124
+ /**
125
+ * @dev Cancels a time-locked transaction using a meta-transaction
126
+ * @param metaTx The meta-transaction containing the transaction record and signature
127
+ * @return The transaction ID (use getTransaction(txId) for full record)
128
+ * @notice Requires STANDARD execution type and EXECUTE_META_CANCEL permission for the execution function
129
+ */
130
+ function cancelTimeLockExecutionWithMetaTx(
131
+ EngineBlox.MetaTransaction memory metaTx
132
+ ) external returns (uint256);
133
+
134
+ /**
135
+ * @dev Requests and approves a transaction in one step using a meta-transaction
136
+ * @param metaTx The meta-transaction containing the transaction record and signature
137
+ * @return The transaction ID (use getTransaction(txId) for full record)
138
+ * @notice Requires STANDARD execution type
139
+ * @notice Validates function schema and permissions for the execution function (same as executeWithTimeLock)
140
+ * @notice Requires EXECUTE_META_REQUEST_AND_APPROVE permission for the execution function selector
141
+ */
142
+ function requestAndApproveExecution(
143
+ EngineBlox.MetaTransaction memory metaTx
144
+ ) external returns (uint256);
145
+ }
146
+