From c3206a6901b585225d9e675b9b649d704e59daf7 Mon Sep 17 00:00:00 2001 From: maxnorm Date: Thu, 26 Feb 2026 08:53:15 -0500 Subject: [PATCH 1/4] add erc20 & erc165 exportSelectors on facets --- src/diamond/DiamondInspectFacet.sol | 5 +++++ src/diamond/DiamondUpgradeFacet.sol | 7 ++++++- src/interfaceDetection/ERC165/ERC165Facet.sol | 11 +++++++++++ src/token/ERC20/Approve/ERC20ApproveFacet.sol | 11 +++++++++++ .../ERC20/Bridgeable/ERC20BridgeableFacet.sol | 13 +++++++++++++ src/token/ERC20/Burn/ERC20BurnFacet.sol | 12 ++++++++++++ src/token/ERC20/Data/ERC20DataFacet.sol | 12 ++++++++++++ .../ERC20/Metadata/ERC20MetadataFacet.sol | 12 ++++++++++++ src/token/ERC20/Permit/ERC20PermitFacet.sol | 19 +++++++++++++++++++ .../ERC20/Transfer/ERC20TransferFacet.sol | 12 ++++++++++++ 10 files changed, 113 insertions(+), 1 deletion(-) diff --git a/src/diamond/DiamondInspectFacet.sol b/src/diamond/DiamondInspectFacet.sol index 9fbc8033..962f0516 100644 --- a/src/diamond/DiamondInspectFacet.sol +++ b/src/diamond/DiamondInspectFacet.sol @@ -161,6 +161,11 @@ contract DiamondInspectFacet { } } + /** + * @notice Exports the function selectors of the ERC165 facet + * @dev This function is used to export the function selectors of the ERC165 facet + * @return selectors The function selectors of the ERC165 facet + */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( this.facetAddress.selector, diff --git a/src/diamond/DiamondUpgradeFacet.sol b/src/diamond/DiamondUpgradeFacet.sol index 260bc82c..7f1055ea 100644 --- a/src/diamond/DiamondUpgradeFacet.sol +++ b/src/diamond/DiamondUpgradeFacet.sol @@ -714,7 +714,12 @@ contract DiamondUpgradeFacet { } } + /** + * @notice Exports the function selectors of the ERC165 facet + * @dev This function is used to export the function selectors of the ERC165 facet + * @return selectors The function selectors of the ERC165 facet + */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat(DiamondUpgradeFacet.upgradeDiamond.selector); + return bytes.concat(this.upgradeDiamond.selector); } } diff --git a/src/interfaceDetection/ERC165/ERC165Facet.sol b/src/interfaceDetection/ERC165/ERC165Facet.sol index 64eb061a..31048fd9 100644 --- a/src/interfaceDetection/ERC165/ERC165Facet.sol +++ b/src/interfaceDetection/ERC165/ERC165Facet.sol @@ -78,4 +78,15 @@ contract ERC165Facet { return s.supportedInterfaces[_interfaceId]; } + + /** + * @notice Exports the function selectors of the ERC165 facet + * @dev This function is used to export the function selectors of the ERC165 facet + * @return selectors The function selectors of the ERC165 facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.supportsInterface.selector + ); + } } diff --git a/src/token/ERC20/Approve/ERC20ApproveFacet.sol b/src/token/ERC20/Approve/ERC20ApproveFacet.sol index 5643c227..c8726574 100644 --- a/src/token/ERC20/Approve/ERC20ApproveFacet.sol +++ b/src/token/ERC20/Approve/ERC20ApproveFacet.sol @@ -63,4 +63,15 @@ contract ERC20ApproveFacet { emit Approval(msg.sender, _spender, _value); return true; } + + /** + * @notice Exports the function selectors of the ERC20Approve facet + * @dev This function is used to export the function selectors of the ERC20Approve facet + * @return selectors The function selectors of the ERC20Approve facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.approve.selector + ); + } } diff --git a/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol b/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol index d8f87f8b..4c28a611 100644 --- a/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol +++ b/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol @@ -212,4 +212,17 @@ contract ERC20BridgeableFacet { revert ERC20InvalidBridgeAccount(_caller); } } + + /** + * @notice Exports the function selectors of the ERC20Bridgeable facet + * @dev This function is used to export the function selectors of the ERC20Bridgeable facet + * @return selectors The function selectors of the ERC20Bridgeable facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.crosschainMint.selector, + this.crosschainBurn.selector, + this.checkTokenBridge.selector + ); + } } diff --git a/src/token/ERC20/Burn/ERC20BurnFacet.sol b/src/token/ERC20/Burn/ERC20BurnFacet.sol index 960a1de0..570c7ee2 100644 --- a/src/token/ERC20/Burn/ERC20BurnFacet.sol +++ b/src/token/ERC20/Burn/ERC20BurnFacet.sol @@ -101,4 +101,16 @@ contract ERC20BurnFacet { } emit Transfer(_account, address(0), _value); } + + /** + * @notice Exports the function selectors of the ERC20Burn facet + * @dev This function is used to export the function selectors of the ERC20Burn facet + * @return selectors The function selectors of the ERC20Burn facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.burnERC20.selector, + this.burnERC20From.selector + ); + } } diff --git a/src/token/ERC20/Data/ERC20DataFacet.sol b/src/token/ERC20/Data/ERC20DataFacet.sol index b6c8713e..db6b1157 100644 --- a/src/token/ERC20/Data/ERC20DataFacet.sol +++ b/src/token/ERC20/Data/ERC20DataFacet.sol @@ -59,4 +59,16 @@ contract ERC20DataFacet { function allowance(address _owner, address _spender) external view returns (uint256) { return getStorage().allowance[_owner][_spender]; } + + /** + * @notice Exports the function selectors of the ERC20Data facet + * @dev This function is used to export the function selectors of the ERC20Data facet + * @return selectors The function selectors of the ERC20Data facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.totalSupply.selector, + this.balanceOf.selector, + this.allowance.selector + ); } diff --git a/src/token/ERC20/Metadata/ERC20MetadataFacet.sol b/src/token/ERC20/Metadata/ERC20MetadataFacet.sol index 153848c8..dc2a643b 100644 --- a/src/token/ERC20/Metadata/ERC20MetadataFacet.sol +++ b/src/token/ERC20/Metadata/ERC20MetadataFacet.sol @@ -56,4 +56,16 @@ contract ERC20MetadataFacet { function decimals() external view returns (uint8) { return getStorage().decimals; } + + /** + * @notice Exports the function selectors of the ERC20Metadata facet + * @dev This function is used to export the function selectors of the ERC20Metadata facet + * @return selectors The function selectors of the ERC20Metadata facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.name.selector, + this.symbol.selector, + this.decimals.selector + ); } diff --git a/src/token/ERC20/Permit/ERC20PermitFacet.sol b/src/token/ERC20/Permit/ERC20PermitFacet.sol index 5e777fea..2ed1ccac 100644 --- a/src/token/ERC20/Permit/ERC20PermitFacet.sol +++ b/src/token/ERC20/Permit/ERC20PermitFacet.sol @@ -5,6 +5,12 @@ pragma solidity >=0.8.30; * https://compose.diamonds */ + +/** + * @title ERC20PermitFacet + * @notice Facet for ERC20 permit functionality + * @dev Implements EIP-2612: https://eips.ethereum.org/EIPS/eip-2612 + */ contract ERC20PermitFacet { /** * @notice Thrown when a permit signature is invalid or expired. @@ -177,4 +183,17 @@ contract ERC20PermitFacet { s.nonces[_owner] = currentNonce + 1; emit Approval(_owner, _spender, _value); } + + /** + * @notice Exports the function selectors of the ERC20Burn facet + * @dev This function is used to export the function selectors of the ERC20Burn facet + * @return selectors The function selectors of the ERC20Burn facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.nonces.selector, + this.DOMAIN_SEPARATOR.selector, + this.permit.selector + ); + } } diff --git a/src/token/ERC20/Transfer/ERC20TransferFacet.sol b/src/token/ERC20/Transfer/ERC20TransferFacet.sol index 55349017..a0d3f938 100644 --- a/src/token/ERC20/Transfer/ERC20TransferFacet.sol +++ b/src/token/ERC20/Transfer/ERC20TransferFacet.sol @@ -133,4 +133,16 @@ contract ERC20TransferFacet { emit Transfer(_from, _to, _value); return true; } + + /** + * @notice Exports the function selectors of the ERC20Transfer facet + * @dev This function is used to export the function selectors of the ERC20Transfer facet + * @return selectors The function selectors of the ERC20Transfer facet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.transfer.selector, + this.transferFrom.selector + ); + } } From 7a6be18c45b20fa9d22e816377dd9c31f4df9b9c Mon Sep 17 00:00:00 2001 From: maxnorm Date: Thu, 26 Feb 2026 08:57:55 -0500 Subject: [PATCH 2/4] improve exportSelector comments --- src/diamond/DiamondInspectFacet.sol | 8 ++++---- src/diamond/DiamondUpgradeFacet.sol | 6 +++--- src/interfaceDetection/ERC165/ERC165Facet.sol | 6 +++--- src/token/ERC20/Approve/ERC20ApproveFacet.sol | 6 +++--- src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol | 6 +++--- src/token/ERC20/Burn/ERC20BurnFacet.sol | 6 +++--- src/token/ERC20/Data/ERC20DataFacet.sol | 4 ++-- src/token/ERC20/Metadata/ERC20MetadataFacet.sol | 4 ++-- src/token/ERC20/Permit/ERC20PermitFacet.sol | 6 +++--- src/token/ERC20/Transfer/ERC20TransferFacet.sol | 6 +++--- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/diamond/DiamondInspectFacet.sol b/src/diamond/DiamondInspectFacet.sol index 962f0516..d15e2cde 100644 --- a/src/diamond/DiamondInspectFacet.sol +++ b/src/diamond/DiamondInspectFacet.sol @@ -162,10 +162,10 @@ contract DiamondInspectFacet { } /** - * @notice Exports the function selectors of the ERC165 facet - * @dev This function is used to export the function selectors of the ERC165 facet - * @return selectors The function selectors of the ERC165 facet - */ + * @notice Exports the function selectors of the DiamondInspectFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the DiamondInspectFacet + */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( this.facetAddress.selector, diff --git a/src/diamond/DiamondUpgradeFacet.sol b/src/diamond/DiamondUpgradeFacet.sol index 7f1055ea..dfde194e 100644 --- a/src/diamond/DiamondUpgradeFacet.sol +++ b/src/diamond/DiamondUpgradeFacet.sol @@ -715,9 +715,9 @@ contract DiamondUpgradeFacet { } /** - * @notice Exports the function selectors of the ERC165 facet - * @dev This function is used to export the function selectors of the ERC165 facet - * @return selectors The function selectors of the ERC165 facet + * @notice Exports the function selectors of the DiamondUpgradeFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the DiamondUpgradeFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat(this.upgradeDiamond.selector); diff --git a/src/interfaceDetection/ERC165/ERC165Facet.sol b/src/interfaceDetection/ERC165/ERC165Facet.sol index 31048fd9..c52023a1 100644 --- a/src/interfaceDetection/ERC165/ERC165Facet.sol +++ b/src/interfaceDetection/ERC165/ERC165Facet.sol @@ -80,9 +80,9 @@ contract ERC165Facet { } /** - * @notice Exports the function selectors of the ERC165 facet - * @dev This function is used to export the function selectors of the ERC165 facet - * @return selectors The function selectors of the ERC165 facet + * @notice Exports the function selectors of the ERC165Facet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC165Facet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( diff --git a/src/token/ERC20/Approve/ERC20ApproveFacet.sol b/src/token/ERC20/Approve/ERC20ApproveFacet.sol index c8726574..58e1ad03 100644 --- a/src/token/ERC20/Approve/ERC20ApproveFacet.sol +++ b/src/token/ERC20/Approve/ERC20ApproveFacet.sol @@ -65,9 +65,9 @@ contract ERC20ApproveFacet { } /** - * @notice Exports the function selectors of the ERC20Approve facet - * @dev This function is used to export the function selectors of the ERC20Approve facet - * @return selectors The function selectors of the ERC20Approve facet + * @notice Exports the function selectors of the ERC20ApproveFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC20ApproveFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( diff --git a/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol b/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol index 4c28a611..41562db6 100644 --- a/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol +++ b/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol @@ -214,9 +214,9 @@ contract ERC20BridgeableFacet { } /** - * @notice Exports the function selectors of the ERC20Bridgeable facet - * @dev This function is used to export the function selectors of the ERC20Bridgeable facet - * @return selectors The function selectors of the ERC20Bridgeable facet + * @notice Exports the function selectors of the ERC20BridgeableFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC20BridgeableFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( diff --git a/src/token/ERC20/Burn/ERC20BurnFacet.sol b/src/token/ERC20/Burn/ERC20BurnFacet.sol index 570c7ee2..118074a9 100644 --- a/src/token/ERC20/Burn/ERC20BurnFacet.sol +++ b/src/token/ERC20/Burn/ERC20BurnFacet.sol @@ -103,9 +103,9 @@ contract ERC20BurnFacet { } /** - * @notice Exports the function selectors of the ERC20Burn facet - * @dev This function is used to export the function selectors of the ERC20Burn facet - * @return selectors The function selectors of the ERC20Burn facet + * @notice Exports the function selectors of the ERC20BurnFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC20BurnFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( diff --git a/src/token/ERC20/Data/ERC20DataFacet.sol b/src/token/ERC20/Data/ERC20DataFacet.sol index db6b1157..12c23715 100644 --- a/src/token/ERC20/Data/ERC20DataFacet.sol +++ b/src/token/ERC20/Data/ERC20DataFacet.sol @@ -62,8 +62,8 @@ contract ERC20DataFacet { /** * @notice Exports the function selectors of the ERC20Data facet - * @dev This function is used to export the function selectors of the ERC20Data facet - * @return selectors The function selectors of the ERC20Data facet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC20DataFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( diff --git a/src/token/ERC20/Metadata/ERC20MetadataFacet.sol b/src/token/ERC20/Metadata/ERC20MetadataFacet.sol index dc2a643b..9f19c008 100644 --- a/src/token/ERC20/Metadata/ERC20MetadataFacet.sol +++ b/src/token/ERC20/Metadata/ERC20MetadataFacet.sol @@ -59,8 +59,8 @@ contract ERC20MetadataFacet { /** * @notice Exports the function selectors of the ERC20Metadata facet - * @dev This function is used to export the function selectors of the ERC20Metadata facet - * @return selectors The function selectors of the ERC20Metadata facet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC20MetadataFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( diff --git a/src/token/ERC20/Permit/ERC20PermitFacet.sol b/src/token/ERC20/Permit/ERC20PermitFacet.sol index 2ed1ccac..d351e0c2 100644 --- a/src/token/ERC20/Permit/ERC20PermitFacet.sol +++ b/src/token/ERC20/Permit/ERC20PermitFacet.sol @@ -185,9 +185,9 @@ contract ERC20PermitFacet { } /** - * @notice Exports the function selectors of the ERC20Burn facet - * @dev This function is used to export the function selectors of the ERC20Burn facet - * @return selectors The function selectors of the ERC20Burn facet + * @notice Exports the function selectors of the ERC20PermitFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC20PermitFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( diff --git a/src/token/ERC20/Transfer/ERC20TransferFacet.sol b/src/token/ERC20/Transfer/ERC20TransferFacet.sol index a0d3f938..f30cd411 100644 --- a/src/token/ERC20/Transfer/ERC20TransferFacet.sol +++ b/src/token/ERC20/Transfer/ERC20TransferFacet.sol @@ -135,9 +135,9 @@ contract ERC20TransferFacet { } /** - * @notice Exports the function selectors of the ERC20Transfer facet - * @dev This function is used to export the function selectors of the ERC20Transfer facet - * @return selectors The function selectors of the ERC20Transfer facet + * @notice Exports the function selectors of the ERC20TransferFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC20TransferFacet */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( From f5eb8055b0372db7cc14190494f3b85706f2f840 Mon Sep 17 00:00:00 2001 From: maxnorm Date: Thu, 26 Feb 2026 09:01:36 -0500 Subject: [PATCH 3/4] add erc721 exportSelectors on facets --- src/token/ERC721/Approve/ERC721ApproveFacet.sol | 12 ++++++++++++ src/token/ERC721/Burn/ERC721BurnFacet.sol | 12 ++++++++++++ src/token/ERC721/Data/ERC721DataFacet.sol | 14 ++++++++++++++ .../Enumerable/Burn/ERC721EnumerableBurnFacet.sol | 11 +++++++++++ .../Enumerable/Data/ERC721EnumerableDataFacet.sol | 13 +++++++++++++ .../Transfer/ERC721EnumerableTransferFacet.sol | 13 +++++++++++++ src/token/ERC721/Metadata/ERC721MetadataFacet.sol | 13 +++++++++++++ src/token/ERC721/Transfer/ERC721TransferFacet.sol | 13 +++++++++++++ 8 files changed, 101 insertions(+) diff --git a/src/token/ERC721/Approve/ERC721ApproveFacet.sol b/src/token/ERC721/Approve/ERC721ApproveFacet.sol index 8072759d..4887a5cb 100644 --- a/src/token/ERC721/Approve/ERC721ApproveFacet.sol +++ b/src/token/ERC721/Approve/ERC721ApproveFacet.sol @@ -88,4 +88,16 @@ contract ERC721ApproveFacet { getStorage().isApprovedForAll[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved); } + + /** + * @notice Exports the function selectors of the ERC721ApproveFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721ApproveFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.approve.selector, + this.setApprovalForAll.selector + ); + } } diff --git a/src/token/ERC721/Burn/ERC721BurnFacet.sol b/src/token/ERC721/Burn/ERC721BurnFacet.sol index 2a9d8d54..575053db 100644 --- a/src/token/ERC721/Burn/ERC721BurnFacet.sol +++ b/src/token/ERC721/Burn/ERC721BurnFacet.sol @@ -98,4 +98,16 @@ contract ERC721BurnFacet { emit Transfer(owner, address(0), tokenId); } } + + /** + * @notice Exports the function selectors of the ERC721BurnFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721BurnFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.burnERC721.selector, + this.burnERC721s.selector + ); + } } diff --git a/src/token/ERC721/Data/ERC721DataFacet.sol b/src/token/ERC721/Data/ERC721DataFacet.sol index fa5b9df4..4d3cb88f 100644 --- a/src/token/ERC721/Data/ERC721DataFacet.sol +++ b/src/token/ERC721/Data/ERC721DataFacet.sol @@ -90,4 +90,18 @@ contract ERC721DataFacet { function isApprovedForAll(address _owner, address _operator) external view returns (bool) { return getStorage().isApprovedForAll[_owner][_operator]; } + + /** + * @notice Exports the function selectors of the ERC721DataFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721DataFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.balanceOf.selector, + this.ownerOf.selector, + this.getApproved.selector, + this.isApprovedForAll.selector + ); + } } diff --git a/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol b/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol index fd787c1b..be221007 100644 --- a/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol +++ b/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol @@ -122,4 +122,15 @@ contract ERC721EnumerableBurnFacet { emit Transfer(owner, address(0), _tokenId); } + + /** + * @notice Exports the function selectors of the ERC721EnumerableBurnFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721EnumerableBurnFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.burn.selector + ); + } } diff --git a/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol b/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol index 9c91ac95..d7d29023 100644 --- a/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol +++ b/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol @@ -91,4 +91,17 @@ contract ERC721EnumerableDataFacet { } return s.allTokens[_index]; } + + /** + * @notice Exports the function selectors of the ERC721EnumerableDataFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721EnumerableDataFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.totalSupply.selector, + this.tokenOfOwnerByIndex.selector, + this.tokenByIndex.selector + ); + } } diff --git a/src/token/ERC721/Enumerable/Transfer/ERC721EnumerableTransferFacet.sol b/src/token/ERC721/Enumerable/Transfer/ERC721EnumerableTransferFacet.sol index 037c2bbe..f2919a11 100644 --- a/src/token/ERC721/Enumerable/Transfer/ERC721EnumerableTransferFacet.sol +++ b/src/token/ERC721/Enumerable/Transfer/ERC721EnumerableTransferFacet.sol @@ -201,4 +201,17 @@ contract ERC721EnumerableTransferFacet { } } } + + /** + * @notice Exports the function selectors of the ERC721EnumerableTransferFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721EnumerableTransferFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.transferFrom.selector, + bytes4(keccak256("safeTransferFrom(address,address,uint256)")), + bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes)")) + ); + } } diff --git a/src/token/ERC721/Metadata/ERC721MetadataFacet.sol b/src/token/ERC721/Metadata/ERC721MetadataFacet.sol index cb0efe70..cae2744e 100644 --- a/src/token/ERC721/Metadata/ERC721MetadataFacet.sol +++ b/src/token/ERC721/Metadata/ERC721MetadataFacet.sol @@ -120,4 +120,17 @@ contract ERC721MetadataFacet { } return string.concat(s.baseURI, string(tokenIdString)); } + + /** + * @notice Exports the function selectors of the ERC721MetadataFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721MetadataFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.name.selector, + this.symbol.selector, + this.tokenURI.selector + ); + } } diff --git a/src/token/ERC721/Transfer/ERC721TransferFacet.sol b/src/token/ERC721/Transfer/ERC721TransferFacet.sol index 506eb40d..4517a057 100644 --- a/src/token/ERC721/Transfer/ERC721TransferFacet.sol +++ b/src/token/ERC721/Transfer/ERC721TransferFacet.sol @@ -167,4 +167,17 @@ contract ERC721TransferFacet { } } } + + /** + * @notice Exports the function selectors of the ERC721TransferFacet + * @dev This function is use as a selector discovery mechanism for diamonds + * @return selectors The exported function selectors of the ERC721TransferFacet + */ + function exportSelectors() external pure returns (bytes memory) { + return bytes.concat( + this.transferFrom.selector, + bytes4(keccak256("safeTransferFrom(address,address,uint256)")), + bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes)")) + ); + } } From 665189e2fe9e7863ca76d4c43d69399d6c9e2f8d Mon Sep 17 00:00:00 2001 From: maxnorm Date: Thu, 26 Feb 2026 09:09:09 -0500 Subject: [PATCH 4/4] forge fmt --- src/diamond/DiamondInspectFacet.sol | 2 +- src/interfaceDetection/ERC165/ERC165Facet.sol | 4 +--- src/token/ERC20/Approve/ERC20ApproveFacet.sol | 4 +--- src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol | 6 +----- src/token/ERC20/Burn/ERC20BurnFacet.sol | 5 +---- src/token/ERC20/Data/ERC20DataFacet.sol | 7 ++----- src/token/ERC20/Metadata/ERC20MetadataFacet.sol | 7 ++----- src/token/ERC20/Permit/ERC20PermitFacet.sol | 7 +------ src/token/ERC20/Transfer/ERC20TransferFacet.sol | 5 +---- src/token/ERC721/Approve/ERC721ApproveFacet.sol | 5 +---- src/token/ERC721/Burn/ERC721BurnFacet.sol | 5 +---- src/token/ERC721/Data/ERC721DataFacet.sol | 5 +---- .../ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol | 4 +--- .../ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol | 6 +----- src/token/ERC721/Metadata/ERC721MetadataFacet.sol | 6 +----- src/token/ERC721/Transfer/ERC721TransferFacet.sol | 2 +- 16 files changed, 18 insertions(+), 62 deletions(-) diff --git a/src/diamond/DiamondInspectFacet.sol b/src/diamond/DiamondInspectFacet.sol index d15e2cde..4f1c4490 100644 --- a/src/diamond/DiamondInspectFacet.sol +++ b/src/diamond/DiamondInspectFacet.sol @@ -165,7 +165,7 @@ contract DiamondInspectFacet { * @notice Exports the function selectors of the DiamondInspectFacet * @dev This function is use as a selector discovery mechanism for diamonds * @return selectors The exported function selectors of the DiamondInspectFacet - */ + */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( this.facetAddress.selector, diff --git a/src/interfaceDetection/ERC165/ERC165Facet.sol b/src/interfaceDetection/ERC165/ERC165Facet.sol index c52023a1..454e17e9 100644 --- a/src/interfaceDetection/ERC165/ERC165Facet.sol +++ b/src/interfaceDetection/ERC165/ERC165Facet.sol @@ -85,8 +85,6 @@ contract ERC165Facet { * @return selectors The exported function selectors of the ERC165Facet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.supportsInterface.selector - ); + return bytes.concat(this.supportsInterface.selector); } } diff --git a/src/token/ERC20/Approve/ERC20ApproveFacet.sol b/src/token/ERC20/Approve/ERC20ApproveFacet.sol index 58e1ad03..a4914192 100644 --- a/src/token/ERC20/Approve/ERC20ApproveFacet.sol +++ b/src/token/ERC20/Approve/ERC20ApproveFacet.sol @@ -70,8 +70,6 @@ contract ERC20ApproveFacet { * @return selectors The exported function selectors of the ERC20ApproveFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.approve.selector - ); + return bytes.concat(this.approve.selector); } } diff --git a/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol b/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol index 41562db6..634113e1 100644 --- a/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol +++ b/src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol @@ -219,10 +219,6 @@ contract ERC20BridgeableFacet { * @return selectors The exported function selectors of the ERC20BridgeableFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.crosschainMint.selector, - this.crosschainBurn.selector, - this.checkTokenBridge.selector - ); + return bytes.concat(this.crosschainMint.selector, this.crosschainBurn.selector, this.checkTokenBridge.selector); } } diff --git a/src/token/ERC20/Burn/ERC20BurnFacet.sol b/src/token/ERC20/Burn/ERC20BurnFacet.sol index 118074a9..65fcb51f 100644 --- a/src/token/ERC20/Burn/ERC20BurnFacet.sol +++ b/src/token/ERC20/Burn/ERC20BurnFacet.sol @@ -108,9 +108,6 @@ contract ERC20BurnFacet { * @return selectors The exported function selectors of the ERC20BurnFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.burnERC20.selector, - this.burnERC20From.selector - ); + return bytes.concat(this.burnERC20.selector, this.burnERC20From.selector); } } diff --git a/src/token/ERC20/Data/ERC20DataFacet.sol b/src/token/ERC20/Data/ERC20DataFacet.sol index 12c23715..ad2b7560 100644 --- a/src/token/ERC20/Data/ERC20DataFacet.sol +++ b/src/token/ERC20/Data/ERC20DataFacet.sol @@ -66,9 +66,6 @@ contract ERC20DataFacet { * @return selectors The exported function selectors of the ERC20DataFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.totalSupply.selector, - this.balanceOf.selector, - this.allowance.selector - ); + return bytes.concat(this.totalSupply.selector, this.balanceOf.selector, this.allowance.selector); + } } diff --git a/src/token/ERC20/Metadata/ERC20MetadataFacet.sol b/src/token/ERC20/Metadata/ERC20MetadataFacet.sol index 9f19c008..1c3cb660 100644 --- a/src/token/ERC20/Metadata/ERC20MetadataFacet.sol +++ b/src/token/ERC20/Metadata/ERC20MetadataFacet.sol @@ -63,9 +63,6 @@ contract ERC20MetadataFacet { * @return selectors The exported function selectors of the ERC20MetadataFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.name.selector, - this.symbol.selector, - this.decimals.selector - ); + return bytes.concat(this.name.selector, this.symbol.selector, this.decimals.selector); + } } diff --git a/src/token/ERC20/Permit/ERC20PermitFacet.sol b/src/token/ERC20/Permit/ERC20PermitFacet.sol index d351e0c2..cba8b74d 100644 --- a/src/token/ERC20/Permit/ERC20PermitFacet.sol +++ b/src/token/ERC20/Permit/ERC20PermitFacet.sol @@ -5,7 +5,6 @@ pragma solidity >=0.8.30; * https://compose.diamonds */ - /** * @title ERC20PermitFacet * @notice Facet for ERC20 permit functionality @@ -190,10 +189,6 @@ contract ERC20PermitFacet { * @return selectors The exported function selectors of the ERC20PermitFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.nonces.selector, - this.DOMAIN_SEPARATOR.selector, - this.permit.selector - ); + return bytes.concat(this.nonces.selector, this.DOMAIN_SEPARATOR.selector, this.permit.selector); } } diff --git a/src/token/ERC20/Transfer/ERC20TransferFacet.sol b/src/token/ERC20/Transfer/ERC20TransferFacet.sol index f30cd411..19bb51b6 100644 --- a/src/token/ERC20/Transfer/ERC20TransferFacet.sol +++ b/src/token/ERC20/Transfer/ERC20TransferFacet.sol @@ -140,9 +140,6 @@ contract ERC20TransferFacet { * @return selectors The exported function selectors of the ERC20TransferFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.transfer.selector, - this.transferFrom.selector - ); + return bytes.concat(this.transfer.selector, this.transferFrom.selector); } } diff --git a/src/token/ERC721/Approve/ERC721ApproveFacet.sol b/src/token/ERC721/Approve/ERC721ApproveFacet.sol index 4887a5cb..a9c79d4c 100644 --- a/src/token/ERC721/Approve/ERC721ApproveFacet.sol +++ b/src/token/ERC721/Approve/ERC721ApproveFacet.sol @@ -95,9 +95,6 @@ contract ERC721ApproveFacet { * @return selectors The exported function selectors of the ERC721ApproveFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.approve.selector, - this.setApprovalForAll.selector - ); + return bytes.concat(this.approve.selector, this.setApprovalForAll.selector); } } diff --git a/src/token/ERC721/Burn/ERC721BurnFacet.sol b/src/token/ERC721/Burn/ERC721BurnFacet.sol index 575053db..5dba5f1e 100644 --- a/src/token/ERC721/Burn/ERC721BurnFacet.sol +++ b/src/token/ERC721/Burn/ERC721BurnFacet.sol @@ -105,9 +105,6 @@ contract ERC721BurnFacet { * @return selectors The exported function selectors of the ERC721BurnFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.burnERC721.selector, - this.burnERC721s.selector - ); + return bytes.concat(this.burnERC721.selector, this.burnERC721s.selector); } } diff --git a/src/token/ERC721/Data/ERC721DataFacet.sol b/src/token/ERC721/Data/ERC721DataFacet.sol index 4d3cb88f..b8d81aad 100644 --- a/src/token/ERC721/Data/ERC721DataFacet.sol +++ b/src/token/ERC721/Data/ERC721DataFacet.sol @@ -98,10 +98,7 @@ contract ERC721DataFacet { */ function exportSelectors() external pure returns (bytes memory) { return bytes.concat( - this.balanceOf.selector, - this.ownerOf.selector, - this.getApproved.selector, - this.isApprovedForAll.selector + this.balanceOf.selector, this.ownerOf.selector, this.getApproved.selector, this.isApprovedForAll.selector ); } } diff --git a/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol b/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol index be221007..c5d99eea 100644 --- a/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol +++ b/src/token/ERC721/Enumerable/Burn/ERC721EnumerableBurnFacet.sol @@ -129,8 +129,6 @@ contract ERC721EnumerableBurnFacet { * @return selectors The exported function selectors of the ERC721EnumerableBurnFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.burn.selector - ); + return bytes.concat(this.burn.selector); } } diff --git a/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol b/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol index d7d29023..8aa2ba58 100644 --- a/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol +++ b/src/token/ERC721/Enumerable/Data/ERC721EnumerableDataFacet.sol @@ -98,10 +98,6 @@ contract ERC721EnumerableDataFacet { * @return selectors The exported function selectors of the ERC721EnumerableDataFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.totalSupply.selector, - this.tokenOfOwnerByIndex.selector, - this.tokenByIndex.selector - ); + return bytes.concat(this.totalSupply.selector, this.tokenOfOwnerByIndex.selector, this.tokenByIndex.selector); } } diff --git a/src/token/ERC721/Metadata/ERC721MetadataFacet.sol b/src/token/ERC721/Metadata/ERC721MetadataFacet.sol index cae2744e..a618bf2c 100644 --- a/src/token/ERC721/Metadata/ERC721MetadataFacet.sol +++ b/src/token/ERC721/Metadata/ERC721MetadataFacet.sol @@ -127,10 +127,6 @@ contract ERC721MetadataFacet { * @return selectors The exported function selectors of the ERC721MetadataFacet */ function exportSelectors() external pure returns (bytes memory) { - return bytes.concat( - this.name.selector, - this.symbol.selector, - this.tokenURI.selector - ); + return bytes.concat(this.name.selector, this.symbol.selector, this.tokenURI.selector); } } diff --git a/src/token/ERC721/Transfer/ERC721TransferFacet.sol b/src/token/ERC721/Transfer/ERC721TransferFacet.sol index 4517a057..e6c040ef 100644 --- a/src/token/ERC721/Transfer/ERC721TransferFacet.sol +++ b/src/token/ERC721/Transfer/ERC721TransferFacet.sol @@ -177,7 +177,7 @@ contract ERC721TransferFacet { return bytes.concat( this.transferFrom.selector, bytes4(keccak256("safeTransferFrom(address,address,uint256)")), - bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes)")) + bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes)")) ); } }