Skip to content

Commit 35d5653

Browse files
refactor: names added to mappings parameteres (#1350)
Signed-off-by: Alberto Molina <[email protected]>
1 parent ec5c62e commit 35d5653

File tree

7 files changed

+26
-38
lines changed

7 files changed

+26
-38
lines changed

contracts/contracts/core/EnumerableSetBytes4.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ library EnumerableSetBytes4 {
77
bytes4[] _values;
88
// Position of the value in the `values` array, plus 1 because index 0
99
// means a value is not in the set.
10-
mapping(bytes4 => uint256) _indexes;
10+
mapping(bytes4 value => uint256 index) _indexes;
1111
}
1212

1313
// Bytes4Set

contracts/contracts/core/Initializable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ abstract contract Initializable {
99
/**
1010
* @dev Indicates that the contract is in the process of being initialized.
1111
*/
12-
mapping(bytes32 => bool) initialized;
12+
mapping(bytes32 facetKey => bool isInitialized) initialized;
1313
}
1414

1515
/**

contracts/contracts/extensions/HoldManagementStorageWrapper.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ abstract contract HoldManagementStorageWrapper {
1111
*/
1212
struct HoldDataStorage {
1313
int64 totalHeldAmount;
14-
mapping(address => int64) totalHeldAmountByAccount;
15-
mapping(address => mapping(uint256 => IHoldManagement.HoldData)) holdsByAccountAndId;
16-
mapping(address => EnumerableSet.UintSet) holdIdsByAccount;
17-
mapping(address => uint256) nextHoldIdByAccount;
14+
mapping(address tokenHolder => int64 totalHeldAmount) totalHeldAmountByAccount;
15+
mapping(address tokenHolder => mapping(uint256 holdId => IHoldManagement.HoldData holdData)) holdsByAccountAndId;
16+
mapping(address tokenHolder => EnumerableSet.UintSet holdIdSet) holdIdsByAccount;
17+
mapping(address tokenHolder => uint256 nextHoldId) nextHoldIdByAccount;
1818
}
1919

2020
function _holdDataStorage() internal pure returns (HoldDataStorage storage holdDataStorage_) {

contracts/contracts/extensions/RolesStorageWrapper.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ abstract contract RolesStorageWrapper {
1414
}
1515

1616
struct RoleData {
17-
mapping(address => MemberData) members;
17+
mapping(address account => MemberData data) members;
1818
address[] accounts;
1919
}
2020

2121
struct RolesStorage {
22-
mapping(bytes32 => RoleData) roles;
22+
mapping(bytes32 role => RoleData data) roles;
2323
/**
2424
* @dev Array containing all roles
2525
*

contracts/contracts/extensions/SupplierAdminStorageWrapper.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ abstract contract SupplierAdminStorageWrapper is
1313
RolesStorageWrapper
1414
{
1515
struct SupplierAdminStorage {
16-
mapping(address => uint256) supplierAllowances;
17-
mapping(address => bool) unlimitedSupplierAllowances;
16+
mapping(address supplier => uint256 allowance) supplierAllowances;
17+
mapping(address supplier => bool hasUnlimitedAllowance) unlimitedSupplierAllowances;
1818
}
1919

2020
function _getSupplierAllowance(address supplier) internal view returns (uint256) {

contracts/contracts/resolver/BusinessLogicResolverWrapper.sol

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ abstract contract BusinessLogicResolverWrapper is IBusinessLogicResolverWrapper
1212
uint256 latestVersion;
1313
// list of facetIds
1414
bytes32[] activeBusinessLogics;
15-
// facetId -> bool
16-
mapping(bytes32 => bool) businessLogicActive;
17-
// facetId -> pos (one per vesion) -> version + status + address
18-
mapping(bytes32 => IBusinessLogicResolver.BusinessLogicVersion[]) businessLogics;
19-
// keccaak256(facetId, version) -> position
20-
mapping(bytes32 => uint256) businessLogicVersionIndex;
21-
// version to status
22-
mapping(uint256 => IBusinessLogicResolver.VersionStatus) versionStatuses;
23-
mapping(bytes32 => EnumerableSetBytes4.Bytes4Set) selectorBlacklist;
15+
mapping(bytes32 facetId => bool isActive) businessLogicActive;
16+
mapping(bytes32 facetId => IBusinessLogicResolver.BusinessLogicVersion[] versions) businessLogics;
17+
mapping(bytes32 facetIdAndVersion => uint256 index) businessLogicVersionIndex;
18+
mapping(uint256 version => IBusinessLogicResolver.VersionStatus status) versionStatuses;
19+
mapping(bytes32 configId => EnumerableSetBytes4.Bytes4Set list) selectorBlacklist;
2420
}
2521

2622
modifier validVersion(uint256 _version) {

contracts/contracts/resolver/diamondCutManager/DiamondCutManagerWrapper.sol

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,17 @@ import {EnumerableSetBytes4} from '../../core/EnumerableSetBytes4.sol';
1212
abstract contract DiamondCutManagerWrapper is IDiamondCutManager, BusinessLogicResolverWrapper {
1313
struct DiamondCutManagerStorage {
1414
bytes32[] configurations;
15-
mapping(bytes32 => bool) activeConfigurations;
16-
mapping(bytes32 => uint256) latestVersion;
17-
mapping(bytes32 => uint256) batchVersion;
18-
// keccak256(configurationId, version)
19-
mapping(bytes32 => bytes32[]) facetIds;
20-
// keccak256(configurationId, version)
21-
mapping(bytes32 => uint256[]) facetVersions;
22-
// keccak256(configurationId, version, selector)
23-
mapping(bytes32 => address) facetAddress;
24-
// keccak256(configurationId, version, facetId)
25-
mapping(bytes32 => address) addr;
26-
// keccak256(configurationId, version, facetId)
27-
mapping(bytes32 => bytes4[]) selectors;
28-
// keccak256(configurationId, version, selector)
29-
mapping(bytes32 => bytes32) selectorToFacetId;
30-
// keccak256(configurationId, version, facetId)
31-
mapping(bytes32 => bytes4[]) interfaceIds;
32-
// keccak256(configurationId, version, interfaceId)
33-
mapping(bytes32 => bool) supportsInterface;
15+
mapping(bytes32 configId => bool isActive) activeConfigurations;
16+
mapping(bytes32 configId => uint256 lastVersion) latestVersion;
17+
mapping(bytes32 configId => uint256 pendingVersion) batchVersion;
18+
mapping(bytes32 configIdAndVersion => bytes32[] facetIdList) facetIds;
19+
mapping(bytes32 configIdAndVersion => uint256[] facetVersions) facetVersions;
20+
mapping(bytes32 configIdAndVersionAndSelector => address facetAddress) facetAddress;
21+
mapping(bytes32 configIdAndVersionAndFacetId => address facetAddress) addr;
22+
mapping(bytes32 configIdAndVersionAndFacetId => bytes4[] selectorList) selectors;
23+
mapping(bytes32 configIdAndVersionAndSelector => bytes32 facetId) selectorToFacetId;
24+
mapping(bytes32 configIdAndVersionAndFacetId => bytes4[] interfaceList) interfaceIds;
25+
mapping(bytes32 configIdAndVersionAndInterfaceId => bool isSupported) supportsInterface;
3426
}
3527

3628
function _createConfiguration(

0 commit comments

Comments
 (0)