Skip to content

Commit c14835c

Browse files
committed
added aux code indexer interface, fixed more typos
1 parent 5bf96a1 commit c14835c

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

.changeset/nasty-points-wait.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@peeramid-labs/eds": patch
3+
---
4+
5+
added aux file for codeIndex interface in more loose pragma to be more reusable as library

src/ICodeIndexDep.sol

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// SPDX-License-Identifier: CC0-1.0
2+
pragma solidity >=0.8.0 <0.9.0;
3+
4+
// This file is exactly same as ./ICodeIndexer.sol\
5+
// With exception for more loose pragma version
6+
// Updating the CodeIndex pragma directly would cause changing the deployed bytecode for ERC7744
7+
interface ICodeIndex {
8+
event Indexed(address indexed container, bytes32 indexed codeHash);
9+
error alreadyExists(bytes32 id, address source);
10+
11+
function register(address container) external;
12+
13+
function get(bytes32 id) external view returns (address);
14+
}

src/abstracts/Distributor.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract contract Distributor is IDistributor, CodeIndexer, ERC165 {
3131
EnumerableSet.Bytes32Set private distributionsSet;
3232
mapping(address instance => uint256 instanceId) private instanceIds;
3333
mapping(uint256 instance => bytes32 distributorsId) public distributionOf;
34-
mapping(bytes32 distributorsId => DistributionComponent distirbution) public distributionComponents;
34+
mapping(bytes32 distributorsId => DistributionComponent distribution) public distributionComponents;
3535
mapping(bytes32 distributorsId => LibSemver.VersionRequirement VersionRequirement) public versionRequirements;
3636
mapping(uint256 instanceId => LibSemver.Version instanceVersion) public instanceVersions;
3737

@@ -114,7 +114,7 @@ abstract contract Distributor is IDistributor, CodeIndexer, ERC165 {
114114
LibSemver.VersionRequirement memory versionRequirement = versionRequirements[distributorsId];
115115

116116
// External initializer is provided, delegatecall to it
117-
// Countrary, if no initializer is provided, the distribution is expected to be self-initializing
117+
// Contrary, if no initializer is provided, the distribution is expected to be self-initializing
118118
bool externallyInitialized = distributionComponent.initializer == address(0);
119119
bytes4 selector = IInitializer.initialize.selector;
120120
bytes memory instantiationArgs = externallyInitialized ? args : bytes("");
@@ -130,7 +130,7 @@ abstract contract Distributor is IDistributor, CodeIndexer, ERC165 {
130130
instantiationArgs
131131
);
132132
// Unversioned distributions are considered to be at version 0, and are not expected to change
133-
// This might change in the future, as it could make sence to inherit `distributionVersion` from the distribution
133+
// This might change in the future, as it could make sense to inherit `distributionVersion` from the distribution
134134
// Yet for ease of runtime validation and to avoid potential issues, we keep it at 0
135135
instanceVersions[numInstances] = LibSemver.parse(0);
136136
} else {

src/libraries/LibSemver.sol

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity >=0.8.0 <0.9.0;
33
import "@openzeppelin/contracts/utils/Strings.sol";
44
library LibSemver {
5-
error versionMissmatch(string message);
5+
error versionMismatch(string message);
66
struct Version {
77
uint64 major;
88
uint64 minor;
@@ -47,32 +47,32 @@ library LibSemver {
4747
}
4848

4949
function require_exact(Version memory _version1, Version memory _version2) internal pure {
50-
if (toUint256(_version1) != toUint256(_version2)) revert versionMissmatch("Version mismatch");
50+
if (toUint256(_version1) != toUint256(_version2)) revert versionMismatch("Version mismatch");
5151
}
5252

5353
function require_major(Version memory _version1, Version memory _version2) internal pure {
54-
if (_version1.major != _version2.major) revert versionMissmatch("Major version mismatch");
54+
if (_version1.major != _version2.major) revert versionMismatch("Major version mismatch");
5555
}
5656

5757
function require_major_minor(Version memory _version1, Version memory _version2) internal pure {
5858
if (_version1.major != _version2.major || _version1.minor != _version2.minor)
59-
revert versionMissmatch("Major and minor version mismatch");
59+
revert versionMismatch("Major and minor version mismatch");
6060
}
6161

6262
function require_greater_equal(Version memory _version1, Version memory _version2) internal pure {
63-
if (toUint256(_version1) < toUint256(_version2)) revert versionMissmatch("Version is not greater or equal");
63+
if (toUint256(_version1) < toUint256(_version2)) revert versionMismatch("Version is not greater or equal");
6464
}
6565

6666
function require_greater(Version memory _version1, Version memory _version2) internal pure {
67-
if (toUint256(_version1) <= toUint256(_version2)) revert versionMissmatch("Version is not greater");
67+
if (toUint256(_version1) <= toUint256(_version2)) revert versionMismatch("Version is not greater");
6868
}
6969

7070
function require_lesser_equal(Version memory _version1, Version memory _version2) internal pure {
71-
if (toUint256(_version1) > toUint256(_version2)) revert versionMissmatch("Version is not lesser or equal");
71+
if (toUint256(_version1) > toUint256(_version2)) revert versionMismatch("Version is not lesser or equal");
7272
}
7373

7474
function require_lesser(Version memory _version1, Version memory _version2) internal pure {
75-
if (toUint256(_version1) >= toUint256(_version2)) revert versionMissmatch("Version is not lesser");
75+
if (toUint256(_version1) >= toUint256(_version2)) revert versionMismatch("Version is not lesser");
7676
}
7777

7878
function areEqual(Version memory _version1, Version memory _version2) internal pure returns (bool) {

0 commit comments

Comments
 (0)