@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,104 +1,105 @@
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 ISecureOwnable
9
- * @dev Interface for SecureOwnable functionality
10
- * @notice This interface defines SecureOwnable-specific operations
11
- * @notice Note: owner(), getBroadcasters(), and getRecovery() are available through BaseStateMachine
12
- */
13
- interface ISecureOwnable {
14
- // ============ OWNERSHIP MANAGEMENT ============
15
-
16
- /**
17
- * @dev Requests a transfer of ownership
18
- * @return The transaction record
19
- */
20
- function transferOwnershipRequest() external returns (EngineBlox.TxRecord memory);
21
-
22
- /**
23
- * @dev Approves a pending ownership transfer transaction after the release time
24
- * @param txId The transaction ID
25
- * @return The updated transaction record
26
- */
27
- function transferOwnershipDelayedApproval(uint256 txId) external returns (EngineBlox.TxRecord memory);
28
-
29
- /**
30
- * @dev Approves a pending ownership transfer transaction using a meta-transaction
31
- * @param metaTx The meta-transaction
32
- * @return The updated transaction record
33
- */
34
- function transferOwnershipApprovalWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (EngineBlox.TxRecord memory);
35
-
36
- /**
37
- * @dev Cancels a pending ownership transfer transaction
38
- * @param txId The transaction ID
39
- * @return The updated transaction record
40
- */
41
- function transferOwnershipCancellation(uint256 txId) external returns (EngineBlox.TxRecord memory);
42
-
43
- /**
44
- * @dev Cancels a pending ownership transfer transaction using a meta-transaction
45
- * @param metaTx The meta-transaction
46
- * @return The updated transaction record
47
- */
48
- function transferOwnershipCancellationWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (EngineBlox.TxRecord memory);
49
-
50
- // ============ BROADCASTER MANAGEMENT ============
51
-
52
- /**
53
- * @dev Updates the broadcaster address
54
- * @param newBroadcaster The new broadcaster address
55
- * @return The transaction record
56
- */
57
- function updateBroadcasterRequest(address newBroadcaster) external returns (EngineBlox.TxRecord memory);
58
-
59
- /**
60
- * @dev Approves a pending broadcaster update transaction after the release time
61
- * @param txId The transaction ID
62
- * @return The updated transaction record
63
- */
64
- function updateBroadcasterDelayedApproval(uint256 txId) external returns (EngineBlox.TxRecord memory);
65
-
66
- /**
67
- * @dev Approves a pending broadcaster update transaction using a meta-transaction
68
- * @param metaTx The meta-transaction
69
- * @return The updated transaction record
70
- */
71
- function updateBroadcasterApprovalWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (EngineBlox.TxRecord memory);
72
-
73
- /**
74
- * @dev Cancels a pending broadcaster update transaction
75
- * @param txId The transaction ID
76
- * @return The updated transaction record
77
- */
78
- function updateBroadcasterCancellation(uint256 txId) external returns (EngineBlox.TxRecord memory);
79
-
80
- /**
81
- * @dev Cancels a pending broadcaster update transaction using a meta-transaction
82
- * @param metaTx The meta-transaction
83
- * @return The updated transaction record
84
- */
85
- function updateBroadcasterCancellationWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (EngineBlox.TxRecord memory);
86
-
87
- // ============ RECOVERY MANAGEMENT ============
88
-
89
- /**
90
- * @dev Requests and approves a recovery address update using a meta-transaction
91
- * @param metaTx The meta-transaction
92
- * @return The transaction record
93
- */
94
- function updateRecoveryRequestAndApprove(EngineBlox.MetaTransaction memory metaTx) external returns (EngineBlox.TxRecord memory);
95
-
96
- // ============ TIMELOCK MANAGEMENT ============
97
-
98
- /**
99
- * @dev Requests and approves a time lock period update using a meta-transaction
100
- * @param metaTx The meta-transaction
101
- * @return The transaction record
102
- */
103
- function updateTimeLockRequestAndApprove(EngineBlox.MetaTransaction memory metaTx) external returns (EngineBlox.TxRecord memory);
104
- }
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 ISecureOwnable
9
+ * @dev Interface for SecureOwnable functionality
10
+ * @notice This interface defines SecureOwnable-specific operations
11
+ * @notice Note: owner(), getBroadcasters(), and getRecovery() are available through BaseStateMachine
12
+ */
13
+ interface ISecureOwnable {
14
+ // ============ OWNERSHIP MANAGEMENT ============
15
+
16
+ /**
17
+ * @dev Requests a transfer of ownership
18
+ * @return txId The transaction ID (use getTransaction(txId) for full record)
19
+ */
20
+ function transferOwnershipRequest() external returns (uint256 txId);
21
+
22
+ /**
23
+ * @dev Approves a pending ownership transfer transaction after the release time
24
+ * @param txId The transaction ID
25
+ * @return The transaction ID (use getTransaction(txId) for full record)
26
+ */
27
+ function transferOwnershipDelayedApproval(uint256 txId) external returns (uint256);
28
+
29
+ /**
30
+ * @dev Approves a pending ownership transfer transaction using a meta-transaction
31
+ * @param metaTx The meta-transaction
32
+ * @return The transaction ID (use getTransaction(txId) for full record)
33
+ */
34
+ function transferOwnershipApprovalWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (uint256);
35
+
36
+ /**
37
+ * @dev Cancels a pending ownership transfer transaction
38
+ * @param txId The transaction ID
39
+ * @return The transaction ID (use getTransaction(txId) for full record)
40
+ */
41
+ function transferOwnershipCancellation(uint256 txId) external returns (uint256);
42
+
43
+ /**
44
+ * @dev Cancels a pending ownership transfer transaction using a meta-transaction
45
+ * @param metaTx The meta-transaction
46
+ * @return The transaction ID (use getTransaction(txId) for full record)
47
+ */
48
+ function transferOwnershipCancellationWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (uint256);
49
+
50
+ // ============ BROADCASTER MANAGEMENT ============
51
+
52
+ /**
53
+ * @dev Requests an update to the broadcaster at a specific location (index).
54
+ * @param newBroadcaster The new broadcaster address (zero address to revoke at location)
55
+ * @param location The index in the broadcaster role's authorized wallets set
56
+ * @return txId The transaction ID (use getTransaction(txId) for full record)
57
+ */
58
+ function updateBroadcasterRequest(address newBroadcaster, uint256 location) external returns (uint256 txId);
59
+
60
+ /**
61
+ * @dev Approves a pending broadcaster update transaction after the release time
62
+ * @param txId The transaction ID
63
+ * @return The transaction ID (use getTransaction(txId) for full record)
64
+ */
65
+ function updateBroadcasterDelayedApproval(uint256 txId) external returns (uint256);
66
+
67
+ /**
68
+ * @dev Approves a pending broadcaster update transaction using a meta-transaction
69
+ * @param metaTx The meta-transaction
70
+ * @return The transaction ID (use getTransaction(txId) for full record)
71
+ */
72
+ function updateBroadcasterApprovalWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (uint256);
73
+
74
+ /**
75
+ * @dev Cancels a pending broadcaster update transaction
76
+ * @param txId The transaction ID
77
+ * @return The transaction ID (use getTransaction(txId) for full record)
78
+ */
79
+ function updateBroadcasterCancellation(uint256 txId) external returns (uint256);
80
+
81
+ /**
82
+ * @dev Cancels a pending broadcaster update transaction using a meta-transaction
83
+ * @param metaTx The meta-transaction
84
+ * @return The transaction ID (use getTransaction(txId) for full record)
85
+ */
86
+ function updateBroadcasterCancellationWithMetaTx(EngineBlox.MetaTransaction memory metaTx) external returns (uint256);
87
+
88
+ // ============ RECOVERY MANAGEMENT ============
89
+
90
+ /**
91
+ * @dev Requests and approves a recovery address update using a meta-transaction
92
+ * @param metaTx The meta-transaction
93
+ * @return The transaction ID (use getTransaction(txId) for full record)
94
+ */
95
+ function updateRecoveryRequestAndApprove(EngineBlox.MetaTransaction memory metaTx) external returns (uint256);
96
+
97
+ // ============ TIMELOCK MANAGEMENT ============
98
+
99
+ /**
100
+ * @dev Requests and approves a time lock period update using a meta-transaction
101
+ * @param metaTx The meta-transaction
102
+ * @return The transaction ID (use getTransaction(txId) for full record)
103
+ */
104
+ function updateTimeLockRequestAndApprove(EngineBlox.MetaTransaction memory metaTx) external returns (uint256);
105
+ }
@@ -1,9 +1,9 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.33;
2
+ pragma solidity 0.8.34;
3
3
 
4
4
  import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
5
  import "../../../lib/EngineBlox.sol";
6
- import "../../../../interfaces/IDefinition.sol";
6
+ import "../../../lib/interfaces/IDefinition.sol";
7
7
 
8
8
  /**
9
9
  * @title SecureOwnableDefinitions
@@ -32,7 +32,7 @@ library SecureOwnableDefinitions {
32
32
 
33
33
  // Function Selector Constants
34
34
  bytes4 public constant TRANSFER_OWNERSHIP_SELECTOR = bytes4(keccak256("executeTransferOwnership(address)"));
35
- bytes4 public constant UPDATE_BROADCASTER_SELECTOR = bytes4(keccak256("executeBroadcasterUpdate(address)"));
35
+ bytes4 public constant UPDATE_BROADCASTER_SELECTOR = bytes4(keccak256("executeBroadcasterUpdate(address,uint256)"));
36
36
  bytes4 public constant UPDATE_RECOVERY_SELECTOR = bytes4(keccak256("executeRecoveryUpdate(address)"));
37
37
  bytes4 public constant UPDATE_TIMELOCK_SELECTOR = bytes4(keccak256("executeTimeLockUpdate(uint256)"));
38
38
 
@@ -40,7 +40,7 @@ library SecureOwnableDefinitions {
40
40
  bytes4 public constant TRANSFER_OWNERSHIP_REQUEST_SELECTOR = bytes4(keccak256("transferOwnershipRequest()"));
41
41
  bytes4 public constant TRANSFER_OWNERSHIP_DELAYED_APPROVAL_SELECTOR = bytes4(keccak256("transferOwnershipDelayedApproval(uint256)"));
42
42
  bytes4 public constant TRANSFER_OWNERSHIP_CANCELLATION_SELECTOR = bytes4(keccak256("transferOwnershipCancellation(uint256)"));
43
- bytes4 public constant UPDATE_BROADCASTER_REQUEST_SELECTOR = bytes4(keccak256("updateBroadcasterRequest(address)"));
43
+ bytes4 public constant UPDATE_BROADCASTER_REQUEST_SELECTOR = bytes4(keccak256("updateBroadcasterRequest(address,uint256)"));
44
44
  bytes4 public constant UPDATE_BROADCASTER_DELAYED_APPROVAL_SELECTOR = bytes4(keccak256("updateBroadcasterDelayedApproval(uint256)"));
45
45
  bytes4 public constant UPDATE_BROADCASTER_CANCELLATION_SELECTOR = bytes4(keccak256("updateBroadcasterCancellation(uint256)"));
46
46
 
@@ -128,6 +128,7 @@ library SecureOwnableDefinitions {
128
128
  operationType: OWNERSHIP_TRANSFER,
129
129
  operationName: "OWNERSHIP_TRANSFER",
130
130
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaApproveActions),
131
+ enforceHandlerRelations: true,
131
132
  isProtected: true,
132
133
  handlerForSelectors: transferOwnershipHandlerForSelectors
133
134
  });
@@ -138,6 +139,7 @@ library SecureOwnableDefinitions {
138
139
  operationType: OWNERSHIP_TRANSFER,
139
140
  operationName: "OWNERSHIP_TRANSFER",
140
141
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaCancelActions),
142
+ enforceHandlerRelations: true,
141
143
  isProtected: true,
142
144
  handlerForSelectors: transferOwnershipHandlerForSelectors
143
145
  });
@@ -148,6 +150,7 @@ library SecureOwnableDefinitions {
148
150
  operationType: BROADCASTER_UPDATE,
149
151
  operationName: "BROADCASTER_UPDATE",
150
152
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaApproveActions),
153
+ enforceHandlerRelations: true,
151
154
  isProtected: true,
152
155
  handlerForSelectors: broadcasterHandlerForSelectors
153
156
  });
@@ -158,6 +161,7 @@ library SecureOwnableDefinitions {
158
161
  operationType: BROADCASTER_UPDATE,
159
162
  operationName: "BROADCASTER_UPDATE",
160
163
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaCancelActions),
164
+ enforceHandlerRelations: true,
161
165
  isProtected: true,
162
166
  handlerForSelectors: broadcasterHandlerForSelectors
163
167
  });
@@ -168,6 +172,7 @@ library SecureOwnableDefinitions {
168
172
  operationType: RECOVERY_UPDATE,
169
173
  operationName: "RECOVERY_UPDATE",
170
174
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaRequestApproveActions),
175
+ enforceHandlerRelations: true,
171
176
  isProtected: true,
172
177
  handlerForSelectors: recoveryHandlerForSelectors
173
178
  });
@@ -178,6 +183,7 @@ library SecureOwnableDefinitions {
178
183
  operationType: TIMELOCK_UPDATE,
179
184
  operationName: "TIMELOCK_UPDATE",
180
185
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaRequestApproveActions),
186
+ enforceHandlerRelations: true,
181
187
  isProtected: true,
182
188
  handlerForSelectors: timelockHandlerForSelectors
183
189
  });
@@ -189,6 +195,7 @@ library SecureOwnableDefinitions {
189
195
  operationType: OWNERSHIP_TRANSFER,
190
196
  operationName: "OWNERSHIP_TRANSFER",
191
197
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayRequestActions),
198
+ enforceHandlerRelations: true,
192
199
  isProtected: true,
193
200
  handlerForSelectors: transferOwnershipHandlerForSelectors
194
201
  });
@@ -199,6 +206,7 @@ library SecureOwnableDefinitions {
199
206
  operationType: OWNERSHIP_TRANSFER,
200
207
  operationName: "OWNERSHIP_TRANSFER",
201
208
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayApproveActions),
209
+ enforceHandlerRelations: true,
202
210
  isProtected: true,
203
211
  handlerForSelectors: transferOwnershipHandlerForSelectors
204
212
  });
@@ -209,16 +217,18 @@ library SecureOwnableDefinitions {
209
217
  operationType: OWNERSHIP_TRANSFER,
210
218
  operationName: "OWNERSHIP_TRANSFER",
211
219
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayCancelActions),
220
+ enforceHandlerRelations: true,
212
221
  isProtected: true,
213
222
  handlerForSelectors: transferOwnershipHandlerForSelectors
214
223
  });
215
224
 
216
225
  schemas[9] = EngineBlox.FunctionSchema({
217
- functionSignature: "updateBroadcasterRequest(address)",
226
+ functionSignature: "updateBroadcasterRequest(address,uint256)",
218
227
  functionSelector: UPDATE_BROADCASTER_REQUEST_SELECTOR,
219
228
  operationType: BROADCASTER_UPDATE,
220
229
  operationName: "BROADCASTER_UPDATE",
221
230
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayRequestActions),
231
+ enforceHandlerRelations: true,
222
232
  isProtected: true,
223
233
  handlerForSelectors: broadcasterHandlerForSelectors
224
234
  });
@@ -229,6 +239,7 @@ library SecureOwnableDefinitions {
229
239
  operationType: BROADCASTER_UPDATE,
230
240
  operationName: "BROADCASTER_UPDATE",
231
241
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayApproveActions),
242
+ enforceHandlerRelations: true,
232
243
  isProtected: true,
233
244
  handlerForSelectors: broadcasterHandlerForSelectors
234
245
  });
@@ -239,6 +250,7 @@ library SecureOwnableDefinitions {
239
250
  operationType: BROADCASTER_UPDATE,
240
251
  operationName: "BROADCASTER_UPDATE",
241
252
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(timeDelayCancelActions),
253
+ enforceHandlerRelations: true,
242
254
  isProtected: true,
243
255
  handlerForSelectors: broadcasterHandlerForSelectors
244
256
  });
@@ -251,16 +263,18 @@ library SecureOwnableDefinitions {
251
263
  operationType: OWNERSHIP_TRANSFER,
252
264
  operationName: "OWNERSHIP_TRANSFER",
253
265
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(executionApproveCancelActions),
266
+ enforceHandlerRelations: true,
254
267
  isProtected: true,
255
268
  handlerForSelectors: transferOwnershipExecutionHandlerForSelectors
256
269
  });
257
270
 
258
271
  schemas[13] = EngineBlox.FunctionSchema({
259
- functionSignature: "executeBroadcasterUpdate(address)",
272
+ functionSignature: "executeBroadcasterUpdate(address,uint256)",
260
273
  functionSelector: UPDATE_BROADCASTER_SELECTOR,
261
274
  operationType: BROADCASTER_UPDATE,
262
275
  operationName: "BROADCASTER_UPDATE",
263
276
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(executionApproveCancelActions),
277
+ enforceHandlerRelations: true,
264
278
  isProtected: true,
265
279
  handlerForSelectors: broadcasterExecutionHandlerForSelectors
266
280
  });
@@ -271,6 +285,7 @@ library SecureOwnableDefinitions {
271
285
  operationType: RECOVERY_UPDATE,
272
286
  operationName: "RECOVERY_UPDATE",
273
287
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(executionMetaRequestApproveActions),
288
+ enforceHandlerRelations: true,
274
289
  isProtected: true,
275
290
  handlerForSelectors: recoveryExecutionHandlerForSelectors
276
291
  });
@@ -281,6 +296,7 @@ library SecureOwnableDefinitions {
281
296
  operationType: TIMELOCK_UPDATE,
282
297
  operationName: "TIMELOCK_UPDATE",
283
298
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(executionMetaRequestApproveActions),
299
+ enforceHandlerRelations: true,
284
300
  isProtected: true,
285
301
  handlerForSelectors: timelockExecutionHandlerForSelectors
286
302
  });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bloxchain/contracts",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.20",
4
4
  "description": "Library engine for building enterprise grade decentralized permissioned applications",
5
5
  "files": [
6
6
  "core",
7
- "utils",
8
- "interfaces",
9
7
  "abi",
8
+ "standards",
9
+ "components",
10
10
  "README.md"
11
11
  ],
12
12
  "scripts": {
@@ -40,8 +40,8 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
- "@openzeppelin/contracts": "^5.4.0",
44
- "@openzeppelin/contracts-upgradeable": "^5.4.0"
43
+ "@openzeppelin/contracts": "^5.6.1",
44
+ "@openzeppelin/contracts-upgradeable": "^5.6.1"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=18.0.0"
@@ -0,0 +1,12 @@
1
+ # Bloxchain Standards
2
+
3
+ Protocol-level **interfaces** that define optional behaviors and extension points for Blox contracts. These live outside `core/` so the engine stays minimal and stable.
4
+
5
+ ## Structure
6
+
7
+ - **behavior/** – Optional behavior interfaces (e.g. cloneable blox). Implementations live in `components/` or `examples/`.
8
+ - **hooks/** – Hook and trigger interfaces used by the system to call into external contracts (e.g. post-action hooks).
9
+
10
+ ## Usage
11
+
12
+ Contracts in `core/`, `components/`, and `examples/` may depend on these interfaces. New standards should be proposed and reviewed before addition.
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ pragma solidity 0.8.34;
3
+
4
+ /**
5
+ * @title ICopyable
6
+ * @dev Interface for blox contracts that support generic cloning with custom init data.
7
+ *
8
+ * Bloxes implementing this interface can be cloned by factory patterns (e.g. CopyBlox,
9
+ * FactoryBlox) and initialized in one call with owner/broadcaster/recovery/timelock/
10
+ * eventForwarder plus arbitrary init data, or have clone-specific data set
11
+ *
12
+ * Use cases:
13
+ * - Clone and init in one step: factory calls initializeWithData(..., initData).
14
+ * - Clone with standard init then set clone data: factory calls initializeWithData(...)
15
+ */
16
+ interface ICopyable {
17
+ /**
18
+ * @dev Full initialization with standard blox params and custom init data.
19
+ * @param initialOwner The initial owner address
20
+ * @param broadcaster The broadcaster address
21
+ * @param recovery The recovery address
22
+ * @param timeLockPeriodSec The timelock period in seconds
23
+ * @param eventForwarder The event forwarder address (optional, use address(0) to skip)
24
+ * @param initData Custom initialization data (e.g. ABI-encoded config) for this clone
25
+ */
26
+ function initializeWithData(
27
+ address initialOwner,
28
+ address broadcaster,
29
+ address recovery,
30
+ uint256 timeLockPeriodSec,
31
+ address eventForwarder,
32
+ bytes calldata initData
33
+ ) external;
34
+ }
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ pragma solidity 0.8.34;
3
+
4
+ import "../../core/lib/EngineBlox.sol";
5
+
6
+ /**
7
+ * @title IOnActionHook
8
+ * @dev Minimal interface for external hook contracts attached to state machine actions.
9
+ *
10
+ * @notice This interface is intentionally small to keep overall contract size low.
11
+ * @notice The state machine calls this single hook after any transaction operation that
12
+ * produces a TxRecord, providing a centralized post-action entry point.
13
+ */
14
+ interface IOnActionHook {
15
+ /**
16
+ * @dev Called after any transaction operation that produces a TxRecord.
17
+ * This includes request, approve, cancel and meta-tx flows.
18
+ * @param txRecord The transaction record produced by the operation
19
+ */
20
+ function onAction(EngineBlox.TxRecord memory txRecord) external;
21
+ }