Skip to content

Commit f723ccf

Browse files
iobrobertoMiguelLZPFjaime-iobermudezM-Franciadependabot[bot]
authored
sprint 13: feat clearing module and improvements (#378)
Signed-off-by: Roberto Delgado <roberto@io.builders> Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders> Signed-off-by: jaime-iobermudez <jaime.bermudez@io.builders> Signed-off-by: Mario Francia <mario@io.builders> Co-authored-by: Miguel_LZPF <miguel.carpena@io.builders> Co-authored-by: jaime-iobermudez <jaime.bermudez@io.builders> Co-authored-by: Mario Francia <mario@io.builders> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent d026aa6 commit f723ccf

File tree

264 files changed

+37287
-36932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+37287
-36932
lines changed

.github/pull_request_template.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Description
2+
3+
Summarize the change and the issue fixed. Include motivation and context. List dependencies. 📝
4+
5+
Fixes # (issue) 🛠️
6+
7+
## Type of change
8+
9+
- [ ] Bug fix 🐞
10+
- [ ] New feature ✨
11+
- [ ] Breaking change 💥
12+
- [ ] Documentation update 📖
13+
14+
## Testing
15+
16+
Describe tests and instructions to reproduce. 🧪
17+
18+
- [ ] Local Tests (npm run test)
19+
- [ ] Manual (CLI or web interface)
20+
- [ ] Local GitHub Actions (act pull_request)
21+
22+
**Node version**:
23+
24+
- [ ] 18
25+
- [ ] 20
26+
- [x] 22
27+
- [ ] 23
28+
29+
### Test Results (if any)
30+
31+
## Checklist
32+
33+
- [ ] Style Guidelines followed ✅
34+
- [ ] Self-Reviewed 👀
35+
- [ ] Documentation Updated 📚
36+
- [ ] **Linters** - No New Warnings ⚠️
37+
- [ ] Effective Tests Added ✔️
38+
- [ ] Local Tests Pass ✅
39+
- [ ] No reduction of **Coverage**

.husky/pre-commit

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
npm run pre-commit:sdk
1+
npm run pre-commit:contracts
2+
npm run pre-commit:sdk

contracts/.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

contracts/.eslintrc.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

contracts/.prettierignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ cache/
55
coverage/
66
node_modules/
77
package.json
8+
package-lock.json
89
typechain-types/
910
.gitlab-ci.yml
1011
build
11-
package.json
12-
*.md
12+
**/*.md
13+
slither.db.json

contracts/Configuration.ts

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ export const CONTRACT_NAMES = [
251251
'TimeTravel',
252252
'Kyc',
253253
'SsiManagement',
254-
'ClearingFacet',
254+
'ClearingHoldCreationFacet',
255+
'ClearingRedeemFacet',
256+
'ClearingTransferFacet',
257+
'ClearingReadFacet',
255258
'ClearingActionsFacet',
256259
] as const
257260
export type ContractName = (typeof CONTRACT_NAMES)[number]
@@ -286,34 +289,40 @@ export default class Configuration {
286289
// private _contracts: Record<ContractName, ContractConfig>;
287290

288291
public static get privateKeys(): Record<Network, string[]> {
289-
return NETWORKS.reduce((result, network) => {
290-
result[network] = Configuration._getEnvironmentVariableList({
291-
name: `${network.toUpperCase()}_PRIVATE_KEY_#`,
292-
})
293-
return result
294-
}, {} as Record<Network, string[]>)
292+
return NETWORKS.reduce(
293+
(result, network) => {
294+
result[network] = Configuration._getEnvironmentVariableList({
295+
name: `${network.toUpperCase()}_PRIVATE_KEY_#`,
296+
})
297+
return result
298+
},
299+
{} as Record<Network, string[]>
300+
)
295301
}
296302

297303
public static get endpoints(): Record<Network, Endpoints> {
298-
return NETWORKS.reduce((result, network) => {
299-
result[network] = {
300-
jsonRpc: Configuration._getEnvironmentVariable({
301-
name: `${network.toUpperCase()}_JSON_RPC_ENDPOINT`,
302-
defaultValue:
303-
network === 'local'
304-
? 'http://localhost:7546'
305-
: `https://${network}.hash.io/api`,
306-
}),
307-
mirror: Configuration._getEnvironmentVariable({
308-
name: `${network.toUpperCase()}_MIRROR_NODE_ENDPOINT`,
309-
defaultValue:
310-
network === 'local'
311-
? 'http://localhost:5551'
312-
: `https://${network}.mirrornode.hedera.com`,
313-
}),
314-
}
315-
return result
316-
}, {} as Record<Network, Endpoints>)
304+
return NETWORKS.reduce(
305+
(result, network) => {
306+
result[network] = {
307+
jsonRpc: Configuration._getEnvironmentVariable({
308+
name: `${network.toUpperCase()}_JSON_RPC_ENDPOINT`,
309+
defaultValue:
310+
network === 'local'
311+
? 'http://localhost:7546'
312+
: `https://${network}.hash.io/api`,
313+
}),
314+
mirror: Configuration._getEnvironmentVariable({
315+
name: `${network.toUpperCase()}_MIRROR_NODE_ENDPOINT`,
316+
defaultValue:
317+
network === 'local'
318+
? 'http://localhost:5551'
319+
: `https://${network}.mirrornode.hedera.com`,
320+
}),
321+
}
322+
return result
323+
},
324+
{} as Record<Network, Endpoints>
325+
)
317326
}
318327

319328
public static get contracts(): Record<ContractName, ContractConfig> {
@@ -395,7 +404,7 @@ export default class Configuration {
395404
name: string
396405
indexChar?: string
397406
}): string[] {
398-
let resultList: string[] = []
407+
const resultList: string[] = []
399408
let index = 0
400409
do {
401410
const env = Configuration._getEnvironmentVariable({

contracts/contracts/factory/Factory.sol

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ import {IERC1644} from '../layer_1/interfaces/ERC1400/IERC1644.sol';
218218
import {IERC1410Basic} from '../layer_1/interfaces/ERC1400/IERC1410Basic.sol';
219219
import {ICap} from '../layer_1/interfaces/cap/ICap.sol';
220220
import {IERC1594} from '../layer_1/interfaces/ERC1400/IERC1594.sol';
221-
import {IClearing} from '../layer_1/interfaces/clearing/IClearing.sol';
221+
import {
222+
IClearingActions
223+
} from '../layer_1/interfaces/clearing/IClearingActions.sol';
222224
import {
223225
IBusinessLogicResolver
224226
} from '../interfaces/resolver/IBusinessLogicResolver.sol';
@@ -364,6 +366,16 @@ contract Factory is IFactory, LocalContext {
364366
);
365367
}
366368

369+
function getAppliedRegulationData(
370+
RegulationType _regulationType,
371+
RegulationSubType _regulationSubType
372+
) external pure override returns (RegulationData memory regulationData_) {
373+
regulationData_ = buildRegulationData(
374+
_regulationType,
375+
_regulationSubType
376+
);
377+
}
378+
367379
function _deploySecurity(
368380
SecurityData calldata _securityData,
369381
SecurityType _securityType
@@ -413,18 +425,8 @@ contract Factory is IFactory, LocalContext {
413425
_securityData.arePartitionsProtected
414426
);
415427

416-
IClearing(securityAddress_).initialize_Clearing(
428+
IClearingActions(securityAddress_).initializeClearing(
417429
_securityData.clearingActive
418430
);
419431
}
420-
421-
function getAppliedRegulationData(
422-
RegulationType _regulationType,
423-
RegulationSubType _regulationSubType
424-
) external pure override returns (RegulationData memory regulationData_) {
425-
regulationData_ = buildRegulationData(
426-
_regulationType,
427-
_regulationSubType
428-
);
429-
}
430432
}

contracts/contracts/interfaces/resolver/diamondCutManager/IDiamondCutManager.sol

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,6 @@ interface IDiamondCutManager {
229229
uint256 version;
230230
}
231231

232-
// @notice Not able to use bytes32(0) with configurationId
233-
error DefaultValueForConfigurationIdNotPermitted();
234-
235-
/// @notice Not able to use a facetId unregistered
236-
error FacetIdNotRegistered(bytes32 configurationId, bytes32 facetId);
237-
238-
/// @notice Not able to duplicate facetId in list
239-
error DuplicatedFacetInConfiguration(bytes32 facetId);
240-
241-
/// @notice error that occurs when try to create a configuration and the configuration key doesn't exists
242-
error ResolverProxyConfigurationNoRegistered(
243-
bytes32 resolverProxyConfigurationId,
244-
uint256 version
245-
);
246-
247232
/// @notice emited when createConfiguration is executed
248233
event DiamondConfigurationCreated(
249234
bytes32 configurationId,
@@ -262,6 +247,21 @@ interface IDiamondCutManager {
262247
/// @notice emited when cancelBatchConfiguration is executed
263248
event DiamondBatchConfigurationCanceled(bytes32 configurationId);
264249

250+
// @notice Not able to use bytes32(0) with configurationId
251+
error DefaultValueForConfigurationIdNotPermitted();
252+
253+
/// @notice Not able to use a facetId unregistered
254+
error FacetIdNotRegistered(bytes32 configurationId, bytes32 facetId);
255+
256+
/// @notice Not able to duplicate facetId in list
257+
error DuplicatedFacetInConfiguration(bytes32 facetId);
258+
259+
/// @notice error that occurs when try to create a configuration and the configuration key doesn't exists
260+
error ResolverProxyConfigurationNoRegistered(
261+
bytes32 resolverProxyConfigurationId,
262+
uint256 version
263+
);
264+
265265
/// @notice Create a new configuration to the latest version of all facets.
266266
/// @param _configurationId unused identifier to the configuration.
267267
/// @param _facetConfigurations.id list of business logics to be registered.
@@ -286,6 +286,14 @@ interface IDiamondCutManager {
286286
/// @param _configurationId unused identifier to the configuration.
287287
function cancelBatchConfiguration(bytes32 _configurationId) external;
288288

289+
/// @notice check if a resolverProxy is registered. If not revert.
290+
/// @param _configurationId the configuration key to be checked.
291+
/// @param _version configured version in the resolverProxy.
292+
function checkResolverProxyConfigurationRegistered(
293+
bytes32 _configurationId,
294+
uint256 _version
295+
) external;
296+
289297
/// @notice Resolve the facet address knowing configuration, version and selector.
290298
/// @param _configurationId configured key in the resolverProxy.
291299
/// @param _version configured version in the resolverProxy. if is 0, ask for latest version.
@@ -317,14 +325,6 @@ interface IDiamondCutManager {
317325
uint256 _version
318326
) external view returns (bool);
319327

320-
/// @notice check if a resolverProxy is registered. If not revert.
321-
/// @param _configurationId the configuration key to be checked.
322-
/// @param _version configured version in the resolverProxy.
323-
function checkResolverProxyConfigurationRegistered(
324-
bytes32 _configurationId,
325-
uint256 _version
326-
) external;
327-
328328
/// @notice Returns the length of configuration keys
329329
/// @return configurationsLength_
330330
function getConfigurationsLength()

contracts/contracts/interfaces/resolver/resolverProxy/IERC173.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ interface IERC173 {
217217
address indexed newOwner
218218
);
219219

220-
/// @notice Get the address of the owner
221-
/// @return owner_ The address of the owner.
222-
function owner() external view returns (address owner_);
223-
224220
/// @notice Set the address of the new owner of the contract
225221
/// @dev Set _newOwner to address(0) to renounce any ownership.
226222
/// @param _newOwner The address of the new owner of the contract
227223
function transferOwnership(address _newOwner) external;
224+
225+
/// @notice Get the address of the owner
226+
/// @return owner_ The address of the owner.
227+
function owner() external view returns (address owner_);
228228
}

contracts/contracts/interfaces/resolver/resolverProxy/IResolverProxy.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ pragma solidity 0.8.18;
208208
// SPDX-License-Identifier: BSD-3-Clause-Attribution
209209

210210
interface IResolverProxy {
211-
// When no function exists for function called
212-
error FunctionNotFound(bytes4 _functionSelector);
213-
214211
struct Rbac {
215212
bytes32 role;
216213
address[] members;
217214
}
215+
216+
// When no function exists for function called
217+
error FunctionNotFound(bytes4 _functionSelector);
218218
}

0 commit comments

Comments
 (0)