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

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 (42) hide show
  1. package/README.md +7 -7
  2. package/abi/BaseStateMachine.abi.json +85 -45
  3. package/abi/EngineBlox.abi.json +73 -90
  4. package/abi/GuardController.abi.json +252 -806
  5. package/abi/{SimpleVaultDefinitions.abi.json → GuardControllerDefinitions.abi.json} +170 -28
  6. package/abi/IDefinition.abi.json +5 -0
  7. package/abi/RuntimeRBAC.abi.json +155 -218
  8. package/abi/RuntimeRBACDefinitions.abi.json +179 -0
  9. package/abi/SecureOwnable.abi.json +524 -1621
  10. package/abi/SecureOwnableDefinitions.abi.json +5 -0
  11. package/components/README.md +8 -0
  12. package/core/access/RuntimeRBAC.sol +255 -270
  13. package/core/access/interface/IRuntimeRBAC.sol +55 -84
  14. package/core/access/lib/definitions/RuntimeRBACDefinitions.sol +93 -2
  15. package/core/base/BaseStateMachine.sol +193 -107
  16. package/core/base/interface/IBaseStateMachine.sol +153 -153
  17. package/core/execution/GuardController.sol +155 -131
  18. package/core/execution/interface/IGuardController.sol +146 -120
  19. package/core/execution/lib/definitions/GuardControllerDefinitions.sol +193 -43
  20. package/core/lib/EngineBlox.sol +2683 -2322
  21. package/{interfaces → core/lib/interfaces}/IDefinition.sol +49 -49
  22. package/{interfaces → core/lib/interfaces}/IEventForwarder.sol +33 -33
  23. package/{utils → core/lib/utils}/SharedValidation.sol +61 -8
  24. package/core/pattern/Account.sol +84 -0
  25. package/core/security/SecureOwnable.sol +456 -412
  26. package/core/security/interface/ISecureOwnable.sol +105 -104
  27. package/core/security/lib/definitions/SecureOwnableDefinitions.sol +22 -6
  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/core/research/BloxchainWallet.sol +0 -306
  40. package/core/research/erc20-blox/ERC20Blox.sol +0 -140
  41. package/core/research/erc20-blox/lib/definitions/ERC20BloxDefinitions.sol +0 -185
  42. package/interfaces/IOnActionHook.sol +0 -79
@@ -1,153 +1,153 @@
1
- // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.33;
3
-
4
- // Contracts imports
5
- import "../../lib/EngineBlox.sol";
6
-
7
- /**
8
- * @title IBaseStateMachine
9
- * @dev Interface for BaseStateMachine functionality
10
- */
11
- interface IBaseStateMachine {
12
- // ============ CORE TRANSACTION MANAGEMENT ============
13
-
14
- /**
15
- * @dev Creates meta-transaction parameters with specified values
16
- * @param handlerContract The contract that will handle the meta-transaction
17
- * @param handlerSelector The function selector for the handler
18
- * @param action The transaction action type
19
- * @param deadline The timestamp after which the meta-transaction expires
20
- * @param maxGasPrice The maximum gas price allowed for execution
21
- * @param signer The address that will sign the meta-transaction
22
- * @return The formatted meta-transaction parameters
23
- */
24
- function createMetaTxParams(
25
- address handlerContract,
26
- bytes4 handlerSelector,
27
- EngineBlox.TxAction action,
28
- uint256 deadline,
29
- uint256 maxGasPrice,
30
- address signer
31
- ) external view returns (EngineBlox.MetaTxParams memory);
32
-
33
- /**
34
- * @dev Generates an unsigned meta-transaction for a new operation
35
- * @param requester The address requesting the operation
36
- * @param target The target contract address
37
- * @param value The ETH value to send
38
- * @param gasLimit The gas limit for execution
39
- * @param operationType The type of operation
40
- * @param executionSelector The function selector to execute (0x00000000 for simple ETH transfers)
41
- * @param executionParams The encoded parameters for the function (empty for simple ETH transfers)
42
- * @param metaTxParams The meta-transaction parameters
43
- * @return The unsigned meta-transaction
44
- */
45
- function generateUnsignedMetaTransactionForNew(
46
- address requester,
47
- address target,
48
- uint256 value,
49
- uint256 gasLimit,
50
- bytes32 operationType,
51
- bytes4 executionSelector,
52
- bytes memory executionParams,
53
- EngineBlox.MetaTxParams memory metaTxParams
54
- ) external view returns (EngineBlox.MetaTransaction memory);
55
-
56
- /**
57
- * @dev Generates an unsigned meta-transaction for an existing transaction
58
- * @param txId The ID of the existing transaction
59
- * @param metaTxParams The meta-transaction parameters
60
- * @return The unsigned meta-transaction
61
- */
62
- function generateUnsignedMetaTransactionForExisting(
63
- uint256 txId,
64
- EngineBlox.MetaTxParams memory metaTxParams
65
- ) external view returns (EngineBlox.MetaTransaction memory);
66
-
67
- // ============ STATE QUERIES ============
68
-
69
- /**
70
- * @dev Gets transaction history within a specified range
71
- * @param fromTxId The starting transaction ID (inclusive)
72
- * @param toTxId The ending transaction ID (inclusive)
73
- * @return The transaction history within the specified range
74
- */
75
- function getTransactionHistory(uint256 fromTxId, uint256 toTxId) external view returns (EngineBlox.TxRecord[] memory);
76
-
77
- /**
78
- * @dev Gets a transaction by ID
79
- * @param txId The transaction ID
80
- * @return The transaction record
81
- */
82
- function getTransaction(uint256 txId) external view returns (EngineBlox.TxRecord memory);
83
-
84
- /**
85
- * @dev Gets all pending transaction IDs
86
- * @return Array of pending transaction IDs
87
- */
88
- function getPendingTransactions() external view returns (uint256[] memory);
89
-
90
- // ============ ROLE AND PERMISSION QUERIES ============
91
-
92
- /**
93
- * @dev Returns if a wallet is authorized for a role
94
- * @param roleHash The hash of the role to check
95
- * @param wallet The wallet address to check
96
- * @return True if the wallet is authorized for the role, false otherwise
97
- */
98
- function hasRole(bytes32 roleHash, address wallet) external view returns (bool);
99
-
100
- /**
101
- * @dev Returns if an action is supported by a function
102
- * @param functionSelector The function selector to check
103
- * @param action The action to check
104
- * @return True if the action is supported by the function, false otherwise
105
- */
106
- function isActionSupportedByFunction(bytes4 functionSelector, EngineBlox.TxAction action) external view returns (bool);
107
-
108
- /**
109
- * @dev Gets the function permissions for a specific role
110
- * @param roleHash The hash of the role to get permissions for
111
- * @return The function permissions array for the role
112
- */
113
- function getActiveRolePermissions(bytes32 roleHash) external view returns (EngineBlox.FunctionPermission[] memory);
114
-
115
- /**
116
- * @dev Gets the current nonce for a specific signer
117
- * @param signer The address of the signer
118
- * @return The current nonce for the signer
119
- */
120
- function getSignerNonce(address signer) external view returns (uint256);
121
-
122
- // ============ SYSTEM STATE QUERIES ============
123
-
124
- /**
125
- * @dev Returns the supported operation types
126
- * @return The supported operation types
127
- */
128
- function getSupportedOperationTypes() external view returns (bytes32[] memory);
129
-
130
- /**
131
- * @dev Returns the supported roles list
132
- * @return The supported roles list
133
- */
134
- function getSupportedRoles() external view returns (bytes32[] memory);
135
-
136
- /**
137
- * @dev Returns the supported functions list
138
- * @return The supported functions list
139
- */
140
- function getSupportedFunctions() external view returns (bytes4[] memory);
141
-
142
- /**
143
- * @dev Returns the time lock period
144
- * @return The time lock period in seconds
145
- */
146
- function getTimeLockPeriodSec() external view returns (uint256);
147
-
148
- /**
149
- * @dev Returns whether the contract is initialized
150
- * @return bool True if the contract is initialized, false otherwise
151
- */
152
- function initialized() external view returns (bool);
153
- }
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ pragma solidity 0.8.34;
3
+
4
+ // Contracts imports
5
+ import "../../lib/EngineBlox.sol";
6
+
7
+ /**
8
+ * @title IBaseStateMachine
9
+ * @dev Interface for BaseStateMachine functionality
10
+ */
11
+ interface IBaseStateMachine {
12
+ // ============ CORE TRANSACTION MANAGEMENT ============
13
+
14
+ /**
15
+ * @dev Creates meta-transaction parameters with specified values
16
+ * @param handlerContract The contract that will handle the meta-transaction
17
+ * @param handlerSelector The function selector for the handler
18
+ * @param action The transaction action type
19
+ * @param deadline The timestamp after which the meta-transaction expires
20
+ * @param maxGasPrice The maximum gas price allowed for execution
21
+ * @param signer The address that will sign the meta-transaction
22
+ * @return The formatted meta-transaction parameters
23
+ */
24
+ function createMetaTxParams(
25
+ address handlerContract,
26
+ bytes4 handlerSelector,
27
+ EngineBlox.TxAction action,
28
+ uint256 deadline,
29
+ uint256 maxGasPrice,
30
+ address signer
31
+ ) external view returns (EngineBlox.MetaTxParams memory);
32
+
33
+ /**
34
+ * @dev Generates an unsigned meta-transaction for a new operation
35
+ * @param requester The address requesting the operation
36
+ * @param target The target contract address
37
+ * @param value The ETH value to send
38
+ * @param gasLimit The gas limit for execution
39
+ * @param operationType The type of operation
40
+ * @param executionSelector The function selector to execute (0x00000000 for simple ETH transfers)
41
+ * @param executionParams The encoded parameters for the function (empty for simple ETH transfers)
42
+ * @param metaTxParams The meta-transaction parameters
43
+ * @return The unsigned meta-transaction
44
+ */
45
+ function generateUnsignedMetaTransactionForNew(
46
+ address requester,
47
+ address target,
48
+ uint256 value,
49
+ uint256 gasLimit,
50
+ bytes32 operationType,
51
+ bytes4 executionSelector,
52
+ bytes memory executionParams,
53
+ EngineBlox.MetaTxParams memory metaTxParams
54
+ ) external view returns (EngineBlox.MetaTransaction memory);
55
+
56
+ /**
57
+ * @dev Generates an unsigned meta-transaction for an existing transaction
58
+ * @param txId The ID of the existing transaction
59
+ * @param metaTxParams The meta-transaction parameters
60
+ * @return The unsigned meta-transaction
61
+ */
62
+ function generateUnsignedMetaTransactionForExisting(
63
+ uint256 txId,
64
+ EngineBlox.MetaTxParams memory metaTxParams
65
+ ) external view returns (EngineBlox.MetaTransaction memory);
66
+
67
+ // ============ STATE QUERIES ============
68
+
69
+ /**
70
+ * @dev Gets transaction history within a specified range
71
+ * @param fromTxId The starting transaction ID (inclusive)
72
+ * @param toTxId The ending transaction ID (inclusive)
73
+ * @return The transaction history within the specified range
74
+ * @notice Empty array if there are no transactions yet, or if the clamped range does not intersect **1..txCounter**.
75
+ */
76
+ function getTransactionHistory(uint256 fromTxId, uint256 toTxId) external view returns (EngineBlox.TxRecord[] memory);
77
+
78
+ /**
79
+ * @dev Gets a transaction by ID
80
+ * @param txId The transaction ID
81
+ * @return The transaction record
82
+ */
83
+ function getTransaction(uint256 txId) external view returns (EngineBlox.TxRecord memory);
84
+
85
+ /**
86
+ * @dev Gets all pending transaction IDs
87
+ * @return Array of pending transaction IDs
88
+ */
89
+ function getPendingTransactions() external view returns (uint256[] memory);
90
+
91
+ // ============ ROLE AND PERMISSION QUERIES ============
92
+
93
+ /**
94
+ * @dev Returns if a wallet is authorized for a role
95
+ * @param roleHash The hash of the role to check
96
+ * @param wallet The wallet address to check
97
+ * @return True if the wallet is authorized for the role, false otherwise
98
+ */
99
+ function hasRole(bytes32 roleHash, address wallet) external view returns (bool);
100
+
101
+ /**
102
+ * @dev Gets function schema information
103
+ * @param functionSelector The function selector to get information for
104
+ * @return The full FunctionSchema struct
105
+ */
106
+ function getFunctionSchema(bytes4 functionSelector) external view returns (EngineBlox.FunctionSchema memory);
107
+
108
+ /**
109
+ * @dev Gets the function permissions for a specific role
110
+ * @param roleHash The hash of the role to get permissions for
111
+ * @return The function permissions array for the role
112
+ */
113
+ function getActiveRolePermissions(bytes32 roleHash) external view returns (EngineBlox.FunctionPermission[] memory);
114
+
115
+ /**
116
+ * @dev Gets the current nonce for a specific signer
117
+ * @param signer The address of the signer
118
+ * @return The current nonce for the signer
119
+ */
120
+ function getSignerNonce(address signer) external view returns (uint256);
121
+
122
+ // ============ SYSTEM STATE QUERIES ============
123
+
124
+ /**
125
+ * @dev Returns the supported operation types
126
+ * @return The supported operation types
127
+ */
128
+ function getSupportedOperationTypes() external view returns (bytes32[] memory);
129
+
130
+ /**
131
+ * @dev Returns the supported roles list
132
+ * @return The supported roles list
133
+ */
134
+ function getSupportedRoles() external view returns (bytes32[] memory);
135
+
136
+ /**
137
+ * @dev Returns the supported functions list
138
+ * @return The supported functions list
139
+ */
140
+ function getSupportedFunctions() external view returns (bytes4[] memory);
141
+
142
+ /**
143
+ * @dev Returns the time lock period
144
+ * @return The time lock period in seconds
145
+ */
146
+ function getTimeLockPeriodSec() external view returns (uint256);
147
+
148
+ /**
149
+ * @dev Returns whether the contract is initialized
150
+ * @return bool True if the contract is initialized, false otherwise
151
+ */
152
+ function initialized() external view returns (bool);
153
+ }