@web3dotorg/evm-slc-core-contracts 0.3.2

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.
@@ -0,0 +1,381 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
5
+ import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
6
+ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
7
+ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
8
+
9
+ import {Paginator} from "@solarity/solidity-lib/libs/arrays/Paginator.sol";
10
+ import {AMultiOwnable} from "@solarity/solidity-lib/access/AMultiOwnable.sol";
11
+ import {DynamicSet} from "@solarity/solidity-lib/libs/data-structures/DynamicSet.sol";
12
+
13
+ import {IQParameters} from "../interfaces/IQParameters.sol";
14
+
15
+ /**
16
+ * @title ParameterRegistry
17
+ * @notice A multi-owner upgradeable contract for storing and retrieving various parameter types
18
+ */
19
+ contract ParameterRegistry is IQParameters, ERC165, AMultiOwnable, UUPSUpgradeable {
20
+ using EnumerableSet for EnumerableSet.AddressSet;
21
+ using EnumerableSet for EnumerableSet.UintSet;
22
+ using EnumerableSet for EnumerableSet.Bytes32Set;
23
+ using DynamicSet for DynamicSet.StringSet;
24
+
25
+ // keccak256(abi.encode(uint256(keccak256("evm-slc-core.storage.ParameterRegistry")) - 1)) & ~bytes32(uint256(0xff))
26
+ bytes32 private constant PARAMETER_REGISTRY_STORAGE_LOCATION =
27
+ 0xdb4673e5e220d5b2264587470c59af90d833b7a823651ce8108242ad38989400;
28
+
29
+ struct ParameterRegistryStorage {
30
+ // Mappings for fast lookups
31
+ mapping(string key => address value) addressParameters;
32
+ mapping(string key => uint256 value) uintParameters;
33
+ mapping(string key => string value) stringParameters;
34
+ mapping(string key => bytes32 value) bytes32Parameters;
35
+ // Sets for enumeration and pagination
36
+ DynamicSet.StringSet addressSet;
37
+ DynamicSet.StringSet uintSet;
38
+ DynamicSet.StringSet bytes32Set;
39
+ DynamicSet.StringSet stringSet;
40
+ }
41
+
42
+ struct AddressParameter {
43
+ string key;
44
+ address value;
45
+ }
46
+
47
+ struct UintParameter {
48
+ string key;
49
+ uint256 value;
50
+ }
51
+
52
+ struct StringParameter {
53
+ string key;
54
+ string value;
55
+ }
56
+
57
+ struct Bytes32Parameter {
58
+ string key;
59
+ bytes32 value;
60
+ }
61
+
62
+ enum ParameterType {
63
+ ADDRESS,
64
+ UINT,
65
+ STRING,
66
+ BYTES32
67
+ }
68
+
69
+ event AddressParameterSet(string indexed key, address indexed value);
70
+ event UintParameterSet(string indexed key, uint256 indexed value);
71
+ event StringParameterSet(string indexed key, string indexed value);
72
+ event Bytes32ParameterSet(string indexed key, bytes32 indexed value);
73
+
74
+ error ParameterNotFound(string key);
75
+
76
+ /**
77
+ * @notice Initialize the contract with initial owners
78
+ * @param initialOwners_ Array of initial owner addresses
79
+ */
80
+ function __ParameterRegistry_init(address[] calldata initialOwners_) external initializer {
81
+ __AMultiOwnable_init(initialOwners_);
82
+ }
83
+
84
+ /**
85
+ * @notice Set an address parameter
86
+ * @param key_ Parameter key
87
+ * @param value_ Address value to set
88
+ */
89
+ function setAddr(string calldata key_, address value_) external onlyOwner {
90
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
91
+ $.addressParameters[key_] = value_;
92
+ $.addressSet.add(key_);
93
+ emit AddressParameterSet(key_, value_);
94
+ }
95
+
96
+ function removeAddr(string calldata key_) external onlyOwner {
97
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
98
+ $.addressParameters[key_] = address(0);
99
+ $.addressSet.remove(key_);
100
+ emit AddressParameterSet(key_, address(0));
101
+ }
102
+
103
+ /**
104
+ * @notice Set a uint256 parameter
105
+ * @param key_ Parameter key
106
+ * @param value_ Uint256 value to set
107
+ */
108
+ function setUint(string calldata key_, uint256 value_) external onlyOwner {
109
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
110
+ $.uintParameters[key_] = value_;
111
+ $.uintSet.add(key_);
112
+ emit UintParameterSet(key_, value_);
113
+ }
114
+
115
+ function removeUint(string calldata key_) external onlyOwner {
116
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
117
+ $.uintParameters[key_] = 0;
118
+ $.uintSet.remove(key_);
119
+ emit UintParameterSet(key_, 0);
120
+ }
121
+
122
+ /**
123
+ * @notice Set a string parameter
124
+ * @param key_ Parameter key
125
+ * @param value_ String value to set
126
+ */
127
+ function setString(string calldata key_, string calldata value_) external onlyOwner {
128
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
129
+ $.stringParameters[key_] = value_;
130
+ $.stringSet.add(key_);
131
+ emit StringParameterSet(key_, value_);
132
+ }
133
+
134
+ function removeString(string calldata key_) external onlyOwner {
135
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
136
+ $.stringParameters[key_] = "";
137
+ $.stringSet.remove(key_);
138
+ emit StringParameterSet(key_, "");
139
+ }
140
+
141
+ /**
142
+ * @notice Set a bytes32 parameter
143
+ * @param key_ Parameter key
144
+ * @param value_ Bytes32 value to set
145
+ */
146
+ function setBytes32(string calldata key_, bytes32 value_) external onlyOwner {
147
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
148
+ $.bytes32Parameters[key_] = value_;
149
+ $.bytes32Set.add(key_);
150
+ emit Bytes32ParameterSet(key_, value_);
151
+ }
152
+
153
+ function removeBytes32(string calldata key_) external onlyOwner {
154
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
155
+ $.bytes32Parameters[key_] = bytes32(0);
156
+ $.bytes32Set.remove(key_);
157
+ emit Bytes32ParameterSet(key_, bytes32(0));
158
+ }
159
+
160
+ /**
161
+ * @inheritdoc IQParameters
162
+ */
163
+ function getAddr(string calldata key_) external view override returns (address) {
164
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
165
+
166
+ if (!$.addressSet.contains(key_)) {
167
+ revert ParameterNotFound(key_);
168
+ }
169
+
170
+ return $.addressParameters[key_];
171
+ }
172
+
173
+ /**
174
+ * @inheritdoc IQParameters
175
+ */
176
+ function getUint(string calldata key_) external view override returns (uint256) {
177
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
178
+
179
+ if (!$.uintSet.contains(key_)) {
180
+ revert ParameterNotFound(key_);
181
+ }
182
+
183
+ return $.uintParameters[key_];
184
+ }
185
+
186
+ /**
187
+ * @inheritdoc IQParameters
188
+ */
189
+ function getString(string calldata key_) external view override returns (string memory) {
190
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
191
+
192
+ if (!$.stringSet.contains(key_)) {
193
+ revert ParameterNotFound(key_);
194
+ }
195
+
196
+ return $.stringParameters[key_];
197
+ }
198
+
199
+ /**
200
+ * @inheritdoc IQParameters
201
+ */
202
+ function getBytes32(string calldata key_) external view override returns (bytes32) {
203
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
204
+
205
+ if (!$.bytes32Set.contains(key_)) {
206
+ revert ParameterNotFound(key_);
207
+ }
208
+
209
+ return $.bytes32Parameters[key_];
210
+ }
211
+
212
+ /**
213
+ * @notice Get paginated address parameters
214
+ * @param offset_ Starting index
215
+ * @param limit_ Number of items to return
216
+ * @return parameters Array of address parameters
217
+ */
218
+ function getAddressParameters(
219
+ uint256 offset_,
220
+ uint256 limit_
221
+ ) external view returns (AddressParameter[] memory parameters) {
222
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
223
+
224
+ uint256 to_ = Paginator.getTo($.addressSet.length(), offset_, limit_);
225
+ parameters = new AddressParameter[](to_ - offset_);
226
+
227
+ for (uint256 i = offset_; i < to_; ++i) {
228
+ string memory key_ = $.addressSet.at(i);
229
+ parameters[i - offset_] = AddressParameter({
230
+ key: key_,
231
+ value: $.addressParameters[key_]
232
+ });
233
+ }
234
+ }
235
+
236
+ /**
237
+ * @notice Get paginated uint256 parameters
238
+ * @param offset_ Starting index
239
+ * @param limit_ Number of items to return
240
+ * @return parameters Array of uint256 parameters
241
+ */
242
+ function getUintParameters(
243
+ uint256 offset_,
244
+ uint256 limit_
245
+ ) external view returns (UintParameter[] memory parameters) {
246
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
247
+
248
+ uint256 to_ = Paginator.getTo($.uintSet.length(), offset_, limit_);
249
+ parameters = new UintParameter[](to_ - offset_);
250
+
251
+ for (uint256 i = offset_; i < to_; ++i) {
252
+ string memory key_ = $.uintSet.at(i);
253
+ parameters[i - offset_] = UintParameter({key: key_, value: $.uintParameters[key_]});
254
+ }
255
+ }
256
+
257
+ /**
258
+ * @notice Get paginated string parameters
259
+ * @param offset_ Starting index
260
+ * @param limit_ Number of items to return
261
+ * @return parameters Array of string parameters
262
+ */
263
+ function getStringParameters(
264
+ uint256 offset_,
265
+ uint256 limit_
266
+ ) external view returns (StringParameter[] memory parameters) {
267
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
268
+
269
+ uint256 to_ = Paginator.getTo($.stringSet.length(), offset_, limit_);
270
+ parameters = new StringParameter[](to_ - offset_);
271
+
272
+ for (uint256 i = offset_; i < to_; ++i) {
273
+ string memory key_ = $.stringSet.at(i);
274
+ parameters[i - offset_] = StringParameter({
275
+ key: key_,
276
+ value: $.stringParameters[key_]
277
+ });
278
+ }
279
+ }
280
+
281
+ /**
282
+ * @notice Get paginated bytes32 parameters
283
+ * @param offset_ Starting index
284
+ * @param limit_ Number of items to return
285
+ * @return parameters Array of bytes32 parameters
286
+ */
287
+ function getBytes32Parameters(
288
+ uint256 offset_,
289
+ uint256 limit_
290
+ ) external view returns (Bytes32Parameter[] memory parameters) {
291
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
292
+
293
+ uint256 to_ = Paginator.getTo($.bytes32Set.length(), offset_, limit_);
294
+ parameters = new Bytes32Parameter[](to_ - offset_);
295
+
296
+ for (uint256 i = offset_; i < to_; ++i) {
297
+ string memory key_ = $.bytes32Set.at(i);
298
+ parameters[i - offset_] = Bytes32Parameter({
299
+ key: key_,
300
+ value: $.bytes32Parameters[key_]
301
+ });
302
+ }
303
+ }
304
+
305
+ /**
306
+ * @notice Get total count of parameters by type
307
+ * @return addressCount Number of address parameters
308
+ * @return uintCount Number of uint256 parameters
309
+ * @return stringCount Number of string parameters
310
+ * @return bytes32Count Number of bytes32 parameters
311
+ */
312
+ function getParameterCounts()
313
+ external
314
+ view
315
+ returns (
316
+ uint256 addressCount,
317
+ uint256 uintCount,
318
+ uint256 stringCount,
319
+ uint256 bytes32Count
320
+ )
321
+ {
322
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
323
+
324
+ addressCount = $.addressSet.length();
325
+ uintCount = $.uintSet.length();
326
+ stringCount = $.stringSet.length();
327
+ bytes32Count = $.bytes32Set.length();
328
+ }
329
+
330
+ /**
331
+ * @notice Check if a parameter exists for a given key and type
332
+ * @param key_ Parameter key
333
+ * @param paramType_ Parameter type
334
+ * @return exists True if parameter exists
335
+ */
336
+ function hasParameter(
337
+ string calldata key_,
338
+ ParameterType paramType_
339
+ ) external view returns (bool) {
340
+ ParameterRegistryStorage storage $ = _getParameterRegistryStorage();
341
+
342
+ if (paramType_ == ParameterType.ADDRESS) {
343
+ return $.addressParameters[key_] != address(0);
344
+ } else if (paramType_ == ParameterType.UINT) {
345
+ return $.uintParameters[key_] != 0;
346
+ } else if (paramType_ == ParameterType.STRING) {
347
+ return bytes($.stringParameters[key_]).length > 0;
348
+ }
349
+
350
+ return $.bytes32Parameters[key_] != bytes32(0);
351
+ }
352
+
353
+ /**
354
+ * @notice Check if contract supports a given interface
355
+ * @param interfaceId_ Interface ID to check
356
+ * @return True if interface is supported
357
+ */
358
+ function supportsInterface(bytes4 interfaceId_) public view override returns (bool) {
359
+ return
360
+ interfaceId_ == type(IQParameters).interfaceId ||
361
+ super.supportsInterface(interfaceId_);
362
+ }
363
+
364
+ function implementation() external view returns (address) {
365
+ return ERC1967Utils.getImplementation();
366
+ }
367
+
368
+ // solhint-disable-next-line no-empty-blocks
369
+ function _authorizeUpgrade(address newImplementation_) internal override onlyOwner {}
370
+
371
+ function _getParameterRegistryStorage()
372
+ private
373
+ pure
374
+ returns (ParameterRegistryStorage storage $)
375
+ {
376
+ // solhint-disable-next-line no-inline-assembly
377
+ assembly ("memory-safe") {
378
+ $.slot := PARAMETER_REGISTRY_STORAGE_LOCATION
379
+ }
380
+ }
381
+ }
@@ -0,0 +1,62 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+
6
+ interface IExecutorsRegistry is IERC165 {
7
+ /**
8
+ * @notice Emitted when rewards are distributed to all executors
9
+ * @param totalAmount -- total amount of rewards that were distributed to all executors
10
+ */
11
+ event RewardsDistributed(uint256 totalAmount);
12
+
13
+ /**
14
+ * @notice Emitted when an executor is approved
15
+ * @param executor The address of the approved executor
16
+ */
17
+ event ExecutorApproved(address indexed executor);
18
+
19
+ /**
20
+ * @notice Emitted when an executor is disapproved
21
+ * @param executor The address of the disapproved executor
22
+ */
23
+ event ExecutorDisapproved(address indexed executor);
24
+
25
+ event ExecutorMovedToStandby(address indexed executor);
26
+ event RewardsClaimed(address indexed executor, uint256 amount);
27
+ event ExecutorActivated(address indexed executor, uint256 stake);
28
+ event ExecutorStaked(address indexed executor, uint256 amount, uint256 totalStake);
29
+ event ExecutorUnstaked(address indexed executor, uint256 amount, uint256 remainingStake);
30
+ event WithdrawalAnnounced(address indexed executor, uint256 amount, uint256 availableAt);
31
+ event WithdrawalCancelled(address indexed executor, uint256 amount);
32
+ event ExecutorPaused(address indexed executor);
33
+ event ExecutorUnpaused(address indexed executor);
34
+ event ExecutorSlashed(address indexed executor, uint256 amount, address recipient);
35
+
36
+ error ExecutorHasNoStake(address executor);
37
+ error ExecutorNotApproved(address executor);
38
+ error ExecutorAlreadyApproved(address executor);
39
+ error WithdrawalAlreadyAnnounced(address executor);
40
+ error NoWithdrawalAnnouncement(address executor);
41
+ error WithdrawalNotReady(address executor, uint256 availableAt);
42
+ error ExecutorAlreadyPaused(address executor);
43
+ error ExecutorNotPaused(address executor);
44
+ error InvalidInitialExecutor(address executor);
45
+
46
+ /**
47
+ * @return The number of active executors
48
+ */
49
+ function getExecutorsCount() external returns (uint256);
50
+
51
+ /**
52
+ * @param candidate_ The address of the candidate executor to check
53
+ * @return True if the candidate is an approved executor, false otherwise
54
+ */
55
+ function isExecutor(address candidate_) external returns (bool);
56
+
57
+ /**
58
+ * @notice Distribute rewards to all executors
59
+ * @param amount_ The amount of rewards to distribute to all executors
60
+ */
61
+ function distributeRewards(uint256 amount_) external;
62
+ }
@@ -0,0 +1,57 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+
6
+ interface IGovernance is IERC165 {
7
+ enum OperationType {
8
+ Call,
9
+ DelegateCall
10
+ }
11
+
12
+ struct OperationData {
13
+ OperationType operation_;
14
+ address to_;
15
+ bytes data_;
16
+ uint256 value_;
17
+ }
18
+
19
+ struct OperationBundle {
20
+ OperationData[] operations;
21
+ }
22
+ /**
23
+ * @notice Initiates the process of resolving a service request
24
+ * @param requester_ The address of the requester
25
+ * @param serviceFee_ The fee for the service request. In case of pay with native token, should be equal to msg.value.
26
+ * @param neutralsNumber_ The number of neutrals which will be selected for resolving service request
27
+ * @param additionalLink_ The additional link for the service request
28
+ * @param data_ Additional data for the service request
29
+ */
30
+ function processServiceRequest(
31
+ address requester_,
32
+ uint256 serviceFee_,
33
+ uint256 neutralsNumber_,
34
+ string memory additionalLink_,
35
+ bytes memory data_
36
+ ) external payable returns (bool);
37
+
38
+ /**
39
+ * @notice Allow selected neutral to propose the operation
40
+ * @param proposalId_ The id of the target proposal
41
+ * @param operationBundle_ Proposed operation bundle
42
+ */
43
+ function proposeOperations(
44
+ uint256 proposalId_,
45
+ OperationBundle memory operationBundle_
46
+ ) external;
47
+
48
+ /**
49
+ * @return The address of the system token used for governance operations
50
+ */
51
+ function getSystemToken() external view returns (address);
52
+
53
+ /**
54
+ * @return The address of parameters registry
55
+ */
56
+ function getParametersRegistry() external view returns (address);
57
+ }
@@ -0,0 +1,72 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+
6
+ interface INeutralsRegistry is IERC165 {
7
+ event RewardsDistributed(address[] selectedNeutrals, uint256 totalAmount);
8
+ event NeutralMovedToStandby(address indexed neutral);
9
+ event RewardsClaimed(address indexed neutral, uint256 amount);
10
+ event NeutralActivated(address indexed neutral, uint256 stake);
11
+ event NeutralStaked(address indexed neutral, uint256 amount, uint256 totalStake);
12
+ event NeutralUnstaked(address indexed neutral, uint256 amount, uint256 remainingStake);
13
+ event WithdrawalAnnounced(address indexed neutral, uint256 amount, uint256 availableAt);
14
+ event WithdrawalCancelled(address indexed neutral, uint256 amount);
15
+ event NeutralPaused(address indexed neutral);
16
+ event NeutralUnpaused(address indexed neutral);
17
+ event DelegationWithdrawn(address delegator, address neutral, uint256 amount);
18
+ event NeutralSlashed(address indexed neutral, uint256 amount, address recipient);
19
+
20
+ error NeutralHasNoStake(address neutral);
21
+ error NeutralNotPaused(address neutral);
22
+ error NeutralAlreadyPaused(address neutral);
23
+ error InvalidDelegationAmount(uint256 amount);
24
+ error MaxDelegationAmplificationConstraintViolated(
25
+ uint256 requestedDelegation,
26
+ uint256 currentDelegatedStake,
27
+ uint256 maxPossibleDelegatedStake
28
+ );
29
+ error InsufficientDelegationAmount(
30
+ address delegator,
31
+ address neutral,
32
+ uint256 requested,
33
+ uint256 availible
34
+ );
35
+ error WithdrawalAlreadyAnnounced(address subject);
36
+ error NoWithdrawalAnnouncement(address subject);
37
+ error NeutralCannotDelegateToHimself(address subject);
38
+ error WithdrawalNotReady(address subject, uint256 availableAt);
39
+ error SelectedNeutralsNumberOutOfRange(uint256 providedNumber, uint256 activeNeutralsCount);
40
+
41
+ /**
42
+ * @param number_ The number of neutrals to select
43
+ * @return An array of addresses of selected neutrals based on their total stake
44
+ */
45
+ function getNeutralsSlice(uint256 number_) external view returns (address[] memory);
46
+
47
+ /**
48
+ * @notice Returns the number of active neutrals
49
+ * @return The number of active neutrals
50
+ */
51
+ function getNeutralsCount() external view returns (uint256);
52
+
53
+ /**
54
+ * @notice Checks if the provided address is active neutral(has enough stake)
55
+ * @param candidate_ The address of the candidate neutral to check
56
+ */
57
+ function isNeutral(address candidate_) external view returns (bool);
58
+
59
+ /**
60
+ * @notice Slashes the neutral by the specified amount of tokens
61
+ * @param neutral_ The neutral to be slashed
62
+ * @param amount_ The amount of tokens on which the neutral will be slashed
63
+ */
64
+ function slashNeutral(address neutral_, uint256 amount_) external;
65
+
66
+ /**
67
+ * @notice Distributes rewards to selected neutrals
68
+ * @param selectedNeutrals_ The addresses of the selected neutrals
69
+ * @param amount_ The amount of rewards to distribute to all neutrals
70
+ */
71
+ function distributeRewards(address[] calldata selectedNeutrals_, uint256 amount_) external;
72
+ }
@@ -0,0 +1,37 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ /**
5
+ * @title Parameters interface for the Q System
6
+ * @notice Simplified version of the Q Parameters contract
7
+ * https://gitlab.com/q-dev/system-contracts/-/blob/master/contracts/governance/IParameters.sol
8
+ */
9
+ interface IQParameters {
10
+ /**
11
+ * @notice Returns the address from the list by the given key, if it is in the list
12
+ * @param _key Parameter key
13
+ * @return address value
14
+ */
15
+ function getAddr(string calldata _key) external view returns (address);
16
+
17
+ /**
18
+ * @notice Returns uint256 from the list by the given key, if it is in the list
19
+ * @param _key Parameter key
20
+ * @return decimal number
21
+ */
22
+ function getUint(string calldata _key) external view returns (uint256);
23
+
24
+ /**
25
+ * @notice Returns a string from the list by the given key, if it is in the list
26
+ * @param _key Parameter key
27
+ * @return string value
28
+ */
29
+ function getString(string calldata _key) external view returns (string memory);
30
+
31
+ /**
32
+ * @notice Returns byte32 from the list by the given key, if it is in the list
33
+ * @param _key Parameter key
34
+ * @return byte32 value
35
+ */
36
+ function getBytes32(string calldata _key) external view returns (bytes32);
37
+ }
@@ -0,0 +1,59 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+
6
+ import {IGovernance} from "./IGovernance.sol";
7
+
8
+ interface ISLCCore is IERC165 {
9
+ event SLCInitialized(address indexed creator, string legalDocumentLink);
10
+ event ServiceRequested(
11
+ address indexed requester,
12
+ uint256 indexed serviceFee,
13
+ uint256 indexed neutralsNumber,
14
+ string additionalLink
15
+ );
16
+ event ArbitraryExecute(
17
+ IGovernance.OperationType operation,
18
+ address to,
19
+ bytes data,
20
+ uint256 value
21
+ );
22
+
23
+ error NotGovernance(address sender);
24
+ error FailedToExecuteArbitraryCall(
25
+ IGovernance.OperationType operation,
26
+ address to,
27
+ bytes data,
28
+ uint256 value
29
+ );
30
+
31
+ /**
32
+ * @notice Request a service request from the SLC
33
+ * @param serviceFee_ The fee for the service request. In case of pay with native token, should be equal to msg.value.
34
+ * @param neutralsNumber_ The number of neutrals which will be selected for resolving service request
35
+ * @param additionalLink_ The additional link for the service request
36
+ * @param data_ Additional data for the service request
37
+ */
38
+ function requestService(
39
+ uint256 serviceFee_,
40
+ uint256 neutralsNumber_,
41
+ string memory additionalLink_,
42
+ bytes memory data_
43
+ ) external payable returns (bool);
44
+
45
+ /**
46
+ * @notice Execute code from SLC Core
47
+ * @param operation_ Operation type (Call or DelegateCall)
48
+ * @param to_ The address to which the operation will be executed
49
+ * @param data_ The data to be sent with the operation
50
+ * @param value_ The value to be sent with the operation
51
+ * @return True if the operation was executed successfully, false otherwise
52
+ */
53
+ function arbitraryExecute(
54
+ IGovernance.OperationType operation_,
55
+ address to_,
56
+ bytes memory data_,
57
+ uint256 value_
58
+ ) external returns (bool);
59
+ }
@@ -0,0 +1,29 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+
6
+ interface ISLCCoreFactory is IERC165 {
7
+ function deploySLC(string calldata legalDocumentLink_) external returns (address);
8
+
9
+ function deploySLCWithGovernance(
10
+ address governance_,
11
+ string calldata legalDocumentLink_
12
+ ) external returns (address);
13
+
14
+ function predictSLCAddress(
15
+ address slcDeployer_,
16
+ uint256 nonce_
17
+ ) external view returns (address);
18
+
19
+ function getDeployedSLCs(
20
+ uint256 offset_,
21
+ uint256 limit_
22
+ ) external view returns (address[] memory);
23
+
24
+ function getSalt(address slcDeployer_, uint256 nonce_) external pure returns (bytes32);
25
+
26
+ function isSLCCore(address toCheck_) external view returns (bool);
27
+
28
+ function nonces(address owner_) external view returns (uint256);
29
+ }