@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
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.21",
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.35;
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.35;
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
+ }