@bloxchain/contracts 1.0.0-alpha.7 → 1.0.0

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 (52) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +8 -9
  3. package/abi/BaseStateMachine.abi.json +773 -822
  4. package/abi/EngineBlox.abi.json +562 -552
  5. package/abi/GuardController.abi.json +1597 -1609
  6. package/abi/GuardControllerDefinitions.abi.json +235 -199
  7. package/abi/IDefinition.abi.json +57 -47
  8. package/abi/RuntimeRBAC.abi.json +841 -842
  9. package/abi/RuntimeRBACDefinitions.abi.json +212 -202
  10. package/abi/SecureOwnable.abi.json +1365 -1349
  11. package/abi/SecureOwnableDefinitions.abi.json +174 -164
  12. package/core/AUDIT.md +45 -0
  13. package/core/access/RuntimeRBAC.sol +130 -61
  14. package/core/access/interface/IRuntimeRBAC.sol +3 -3
  15. package/core/access/lib/definitions/RuntimeRBACDefinitions.sol +7 -3
  16. package/core/base/BaseStateMachine.sol +971 -967
  17. package/core/base/interface/IBaseStateMachine.sol +153 -160
  18. package/core/execution/GuardController.sol +89 -75
  19. package/core/execution/interface/IGuardController.sol +146 -160
  20. package/core/execution/lib/definitions/GuardControllerDefinitions.sol +136 -25
  21. package/core/lib/EngineBlox.sol +577 -327
  22. package/core/lib/interfaces/IDefinition.sol +49 -49
  23. package/core/lib/interfaces/IEventForwarder.sol +4 -2
  24. package/core/lib/utils/SharedValidation.sol +534 -490
  25. package/core/pattern/Account.sol +84 -75
  26. package/core/security/SecureOwnable.sol +446 -390
  27. package/core/security/interface/ISecureOwnable.sol +105 -105
  28. package/core/security/lib/definitions/SecureOwnableDefinitions.sol +49 -17
  29. package/package.json +51 -49
  30. package/standards/behavior/ICopyable.sol +3 -11
  31. package/standards/hooks/IOnActionHook.sol +1 -1
  32. package/abi/AccountBlox.abi.json +0 -3935
  33. package/abi/BareBlox.abi.json +0 -1378
  34. package/abi/RoleBlox.abi.json +0 -2983
  35. package/abi/SecureBlox.abi.json +0 -2753
  36. package/abi/SimpleRWA20.abi.json +0 -4032
  37. package/abi/SimpleRWA20Definitions.abi.json +0 -191
  38. package/abi/SimpleVault.abi.json +0 -3407
  39. package/abi/SimpleVaultDefinitions.abi.json +0 -269
  40. package/core/research/BloxchainWallet.sol +0 -133
  41. package/core/research/FactoryBlox/FactoryBlox.sol +0 -343
  42. package/core/research/FactoryBlox/FactoryBloxDefinitions.sol +0 -143
  43. package/core/research/erc1155-blox/ERC1155Blox.sol +0 -169
  44. package/core/research/erc1155-blox/lib/definitions/ERC1155BloxDefinitions.sol +0 -203
  45. package/core/research/erc20-blox/ERC20Blox.sol +0 -167
  46. package/core/research/erc20-blox/lib/definitions/ERC20BloxDefinitions.sol +0 -185
  47. package/core/research/erc721-blox/ERC721Blox.sol +0 -131
  48. package/core/research/erc721-blox/lib/definitions/ERC721BloxDefinitions.sol +0 -172
  49. package/core/research/lending-blox/.gitkeep +0 -1
  50. package/core/research/p2p-blox/P2PBlox.sol +0 -266
  51. package/core/research/p2p-blox/README.md +0 -85
  52. package/core/research/p2p-blox/lib/definitions/P2PBloxDefinitions.sol +0 -19
@@ -1,75 +1,84 @@
1
- // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.33;
3
-
4
- import "../execution/GuardController.sol";
5
- import "../access/RuntimeRBAC.sol";
6
- import "../security/SecureOwnable.sol";
7
- import "../lib/utils/SharedValidation.sol";
8
-
9
- /**
10
- * @title Account
11
- * @dev Abstract account pattern combining GuardController, RuntimeRBAC, and SecureOwnable.
12
- *
13
- * Use this as the base for account-style contracts (e.g. AccountBlox) to avoid duplicating
14
- * initialization, interface support, and receive/fallback boilerplate.
15
- *
16
- * Combines:
17
- * - GuardController: Execution workflows and time-locked transactions
18
- * - RuntimeRBAC: Runtime role creation and management
19
- * - SecureOwnable: Secure ownership transfer and management
20
- *
21
- * @custom:security-contact security@particlecs.com
22
- */
23
- abstract contract Account is GuardController, RuntimeRBAC, SecureOwnable {
24
- /**
25
- * @dev Emitted when plain ETH is received (receive()).
26
- * @param sender Address that sent the ETH
27
- * @param value Amount of wei received
28
- * @custom:security Gas-efficient so receive() stays within 2,300 gas stipend (transfer/send compatible).
29
- */
30
- event EthReceived(address indexed sender, uint256 value);
31
-
32
- /**
33
- * @notice Initializer for the Account pattern (GuardController + RuntimeRBAC + SecureOwnable).
34
- * @param initialOwner The initial owner address
35
- * @param broadcaster The broadcaster address
36
- * @param recovery The recovery address
37
- * @param timeLockPeriodSec The timelock period in seconds
38
- * @param eventForwarder The event forwarder address (optional)
39
- */
40
- function initialize(
41
- address initialOwner,
42
- address broadcaster,
43
- address recovery,
44
- uint256 timeLockPeriodSec,
45
- address eventForwarder
46
- ) public virtual override(GuardController, RuntimeRBAC, SecureOwnable) onlyInitializing {
47
- GuardController.initialize(initialOwner, broadcaster, recovery, timeLockPeriodSec, eventForwarder);
48
- RuntimeRBAC.initialize(initialOwner, broadcaster, recovery, timeLockPeriodSec, eventForwarder);
49
- SecureOwnable.initialize(initialOwner, broadcaster, recovery, timeLockPeriodSec, eventForwarder);
50
- }
51
-
52
- /**
53
- * @dev See {IERC165-supportsInterface}.
54
- */
55
- function supportsInterface(bytes4 interfaceId) public view virtual override(GuardController, RuntimeRBAC, SecureOwnable) returns (bool) {
56
- return GuardController.supportsInterface(interfaceId) || RuntimeRBAC.supportsInterface(interfaceId) || SecureOwnable.supportsInterface(interfaceId);
57
- }
58
-
59
- /**
60
- * @dev Accepts plain ETH transfers (no calldata).
61
- * @notice General-use wallet: ETH can be sent naturally; balance is credited.
62
- * @custom:security No external calls—reentrancy-safe; outgoing ETH only via GuardController execution. Uses simple emit to stay within 2,300 gas stipend (transfer/send compatible).
63
- */
64
- receive() external payable virtual {
65
- emit EthReceived(msg.sender, msg.value);
66
- }
67
-
68
- /**
69
- * @dev Rejects calls with unknown selector (with or without value).
70
- * @notice Only plain transfers hit receive(); all other calls revert.
71
- */
72
- fallback() external payable virtual {
73
- revert SharedValidation.NotSupported();
74
- }
75
- }
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ pragma solidity 0.8.35;
3
+
4
+ import "../execution/GuardController.sol";
5
+ import "../execution/interface/IGuardController.sol";
6
+ import "../access/RuntimeRBAC.sol";
7
+ import "../access/interface/IRuntimeRBAC.sol";
8
+ import "../security/SecureOwnable.sol";
9
+ import "../security/interface/ISecureOwnable.sol";
10
+ import "../lib/utils/SharedValidation.sol";
11
+
12
+ /**
13
+ * @title Account
14
+ * @dev Abstract account pattern combining GuardController, RuntimeRBAC, and SecureOwnable.
15
+ *
16
+ * Use this as the base for account-style contracts (e.g. AccountBlox) to avoid duplicating
17
+ * initialization, interface support, and receive/fallback boilerplate.
18
+ *
19
+ * Combines:
20
+ * - GuardController: Execution workflows and time-locked transactions
21
+ * - RuntimeRBAC: Runtime role creation and management
22
+ * - SecureOwnable: Secure ownership transfer and management
23
+ *
24
+ * @custom:security-contact security@particlecs.com
25
+ */
26
+ abstract contract Account is GuardController, RuntimeRBAC, SecureOwnable {
27
+ /**
28
+ * @dev Emitted when plain ETH is received (receive()).
29
+ * @param sender Address that sent the ETH
30
+ * @param value Amount of wei received
31
+ * @custom:security Gas-efficient so receive() stays within 2,300 gas stipend (transfer/send compatible).
32
+ */
33
+ event EthReceived(address indexed sender, uint256 value);
34
+
35
+ /**
36
+ * @notice Initializer for the Account pattern (GuardController + RuntimeRBAC + SecureOwnable).
37
+ * @param initialOwner The initial owner address
38
+ * @param broadcaster The broadcaster address
39
+ * @param recovery The recovery address
40
+ * @param timeLockPeriodSec The timelock period in seconds
41
+ * @param eventForwarder The event forwarder address (optional)
42
+ */
43
+ function initialize(
44
+ address initialOwner,
45
+ address broadcaster,
46
+ address recovery,
47
+ uint256 timeLockPeriodSec,
48
+ address eventForwarder
49
+ ) public virtual override(GuardController, RuntimeRBAC, SecureOwnable) onlyInitializing {
50
+ GuardController.initialize(initialOwner, broadcaster, recovery, timeLockPeriodSec, eventForwarder);
51
+ RuntimeRBAC.initialize(initialOwner, broadcaster, recovery, timeLockPeriodSec, eventForwarder);
52
+ SecureOwnable.initialize(initialOwner, broadcaster, recovery, timeLockPeriodSec, eventForwarder);
53
+ }
54
+
55
+ /**
56
+ * @dev See {IERC165-supportsInterface}.
57
+ * @notice GuardController, RuntimeRBAC, and SecureOwnable each extend BaseStateMachine directly; a single
58
+ * `super` chain only walks one branch. We OR the three component interface IDs here, then delegate
59
+ * once to `super` for IBaseStateMachine / ERC165 — avoids tripling BaseStateMachine+ERC165 work.
60
+ */
61
+ function supportsInterface(bytes4 interfaceId) public view virtual override(GuardController, RuntimeRBAC, SecureOwnable) returns (bool) {
62
+ return interfaceId == type(IGuardController).interfaceId
63
+ || interfaceId == type(IRuntimeRBAC).interfaceId
64
+ || interfaceId == type(ISecureOwnable).interfaceId
65
+ || super.supportsInterface(interfaceId);
66
+ }
67
+
68
+ /**
69
+ * @dev Accepts plain ETH transfers (no calldata).
70
+ * @notice General-use wallet: ETH can be sent naturally; balance is credited.
71
+ * @custom:security No external calls—reentrancy-safe; outgoing ETH only via GuardController execution. Uses simple emit to stay within 2,300 gas stipend (transfer/send compatible).
72
+ */
73
+ receive() external payable virtual {
74
+ emit EthReceived(msg.sender, msg.value);
75
+ }
76
+
77
+ /**
78
+ * @dev Rejects calls with unknown selector (with or without value).
79
+ * @notice Only plain transfers hit receive(); all other calls revert.
80
+ */
81
+ fallback() external payable virtual {
82
+ revert SharedValidation.NotSupported();
83
+ }
84
+ }