@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.
- package/README.md +7 -7
- package/abi/BaseStateMachine.abi.json +798 -753
- package/abi/EngineBlox.abi.json +566 -576
- package/abi/GuardController.abi.json +1546 -2095
- package/abi/GuardControllerDefinitions.abi.json +416 -0
- package/abi/IDefinition.abi.json +57 -47
- package/abi/RuntimeRBAC.abi.json +901 -959
- package/abi/RuntimeRBACDefinitions.abi.json +265 -81
- package/abi/SecureOwnable.abi.json +1522 -2581
- package/abi/SecureOwnableDefinitions.abi.json +174 -164
- package/components/README.md +8 -0
- package/core/access/RuntimeRBAC.sol +253 -270
- package/core/access/interface/IRuntimeRBAC.sol +55 -84
- package/core/access/lib/definitions/RuntimeRBACDefinitions.sol +97 -4
- package/core/base/BaseStateMachine.sol +198 -108
- package/core/base/interface/IBaseStateMachine.sol +153 -153
- package/core/execution/GuardController.sol +156 -131
- package/core/execution/interface/IGuardController.sol +146 -120
- package/core/execution/lib/definitions/GuardControllerDefinitions.sol +207 -45
- package/core/lib/EngineBlox.sol +2636 -2322
- package/{interfaces → core/lib/interfaces}/IDefinition.sol +49 -49
- package/{interfaces → core/lib/interfaces}/IEventForwarder.sol +5 -3
- package/{utils → core/lib/utils}/SharedValidation.sol +69 -22
- package/core/pattern/Account.sol +84 -0
- package/core/security/SecureOwnable.sol +180 -146
- package/core/security/interface/ISecureOwnable.sol +105 -104
- package/core/security/lib/definitions/SecureOwnableDefinitions.sol +818 -786
- package/package.json +5 -5
- package/standards/README.md +12 -0
- package/standards/behavior/ICopyable.sol +34 -0
- package/standards/hooks/IOnActionHook.sol +21 -0
- package/abi/AccountBlox.abi.json +0 -5799
- package/abi/BareBlox.abi.json +0 -1284
- package/abi/RoleBlox.abi.json +0 -4209
- package/abi/SecureBlox.abi.json +0 -3828
- package/abi/SimpleRWA20.abi.json +0 -5288
- package/abi/SimpleRWA20Definitions.abi.json +0 -191
- package/abi/SimpleVault.abi.json +0 -4951
- package/abi/SimpleVaultDefinitions.abi.json +0 -269
- package/core/research/BloxchainWallet.sol +0 -306
- package/core/research/erc20-blox/ERC20Blox.sol +0 -140
- package/core/research/erc20-blox/lib/definitions/ERC20BloxDefinitions.sol +0 -185
- package/interfaces/IOnActionHook.sol +0 -79
|
@@ -1,120 +1,146 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
-
pragma solidity 0.8.
|
|
3
|
-
|
|
4
|
-
import "../../lib/EngineBlox.sol";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @title IGuardController
|
|
8
|
-
* @dev Interface for GuardController contract that
|
|
9
|
-
* @notice This interface defines only GuardController-specific methods
|
|
10
|
-
* @notice Functions from BaseStateMachine (createMetaTxParams, generateUnsignedMetaTransaction*, getTransaction,
|
|
11
|
-
* @notice Functions from RuntimeRBAC (
|
|
12
|
-
* @custom:security-contact security@particlecrypto.com
|
|
13
|
-
*/
|
|
14
|
-
interface IGuardController {
|
|
15
|
-
/**
|
|
16
|
-
* @
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* @
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
address
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* @
|
|
56
|
-
* @param
|
|
57
|
-
* @
|
|
58
|
-
* @
|
|
59
|
-
* @notice Requires
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* @
|
|
80
|
-
* @param
|
|
81
|
-
* @
|
|
82
|
-
* @
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
* @
|
|
96
|
-
* @param
|
|
97
|
-
* @return The
|
|
98
|
-
* @notice Requires STANDARD execution type and
|
|
99
|
-
*/
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* @
|
|
108
|
-
* @
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
+
|