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
5 changes: 5 additions & 0 deletions src/diamond/DiamondInspectFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ 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,
Expand Down
7 changes: 6 additions & 1 deletion src/diamond/DiamondUpgradeFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,12 @@ contract DiamondUpgradeFacet {
}
}

/**
* @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(DiamondUpgradeFacet.upgradeDiamond.selector);
return bytes.concat(this.upgradeDiamond.selector);
}
}
9 changes: 9 additions & 0 deletions src/interfaceDetection/ERC165/ERC165Facet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,13 @@ contract ERC165Facet {

return s.supportedInterfaces[_interfaceId];
}

/**
* @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(this.supportsInterface.selector);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC20/Approve/ERC20ApproveFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,13 @@ contract ERC20ApproveFacet {
emit Approval(msg.sender, _spender, _value);
return true;
}

/**
* @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(this.approve.selector);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC20/Bridgeable/ERC20BridgeableFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,13 @@ contract ERC20BridgeableFacet {
revert ERC20InvalidBridgeAccount(_caller);
}
}

/**
* @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(this.crosschainMint.selector, this.crosschainBurn.selector, this.checkTokenBridge.selector);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC20/Burn/ERC20BurnFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,13 @@ contract ERC20BurnFacet {
}
emit Transfer(_account, address(0), _value);
}

/**
* @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(this.burnERC20.selector, this.burnERC20From.selector);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC20/Data/ERC20DataFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,13 @@ 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 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(this.totalSupply.selector, this.balanceOf.selector, this.allowance.selector);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC20/Metadata/ERC20MetadataFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,13 @@ contract ERC20MetadataFacet {
function decimals() external view returns (uint8) {
return getStorage().decimals;
}

/**
* @notice Exports 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(this.name.selector, this.symbol.selector, this.decimals.selector);
}
}
14 changes: 14 additions & 0 deletions src/token/ERC20/Permit/ERC20PermitFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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.
Expand Down Expand Up @@ -177,4 +182,13 @@ contract ERC20PermitFacet {
s.nonces[_owner] = currentNonce + 1;
emit Approval(_owner, _spender, _value);
}

/**
* @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(this.nonces.selector, this.DOMAIN_SEPARATOR.selector, this.permit.selector);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC20/Transfer/ERC20TransferFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,13 @@ contract ERC20TransferFacet {
emit Transfer(_from, _to, _value);
return true;
}

/**
* @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(this.transfer.selector, this.transferFrom.selector);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC721/Approve/ERC721ApproveFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,13 @@ 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);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC721/Burn/ERC721BurnFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,13 @@ 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);
}
}
11 changes: 11 additions & 0 deletions src/token/ERC721/Data/ERC721DataFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,15 @@ 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
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,13 @@ 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,13 @@ 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)"))
);
}
}
9 changes: 9 additions & 0 deletions src/token/ERC721/Metadata/ERC721MetadataFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,13 @@ 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);
}
}
13 changes: 13 additions & 0 deletions src/token/ERC721/Transfer/ERC721TransferFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)"))
);
}
}
Loading