Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,15 @@ abstract contract DiamondCutManagerWrapper is IDiamondCutManager, BusinessLogicR
for (uint256 index; index < length; ) {
bytes4 selector = selectors[index];
bytes32 configVersionSelectorHash = _buildHashSelector(_configurationId, _version, selector);
_dcms.facetAddress[configVersionSelectorHash] = selectorAddress;
_dcms.selectorToFacetId[configVersionSelectorHash] = _facetId;

if (_dcms.facetAddress[configVersionSelectorHash] != address(0)) {
address previousFacetAddress = _dcms.facetAddress[configVersionSelectorHash];
if (previousFacetAddress != selectorAddress)
revert SelectorAlreadyRegistered(previousFacetAddress, selectorAddress);
} else {
_dcms.facetAddress[configVersionSelectorHash] = selectorAddress;
_dcms.selectorToFacetId[configVersionSelectorHash] = _facetId;
}
unchecked {
++index;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ interface IDiamondCutManager {
/// @notice error that occurs when try to add a selector and the selector is blacklisted
error SelectorBlacklisted(bytes4 selector);

/// @notice error that occurs when trying to assign an already assigned selector to a new facet address
error SelectorAlreadyRegistered(address firstAddress, address secondAddress);

/// @notice error that occurs when defining a configuration with an empty facet array list
error EmptyConfiguration();

Expand Down