Skip to content

Commit

Permalink
Sherlock-31: Add supportsInterface for EIP-4494 compliance (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
prateek105 authored Jun 28, 2023
1 parent 2f18a93 commit 61470bf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/base/PermitERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ interface IPermit {
/*** External Functions ***/
/**************************/

function DOMAIN_SEPARATOR() external view returns (bytes32);

/**
* @notice Allows to retrieve current nonce for token.
* @param tokenId token id
* @return current token nonce
*/
function nonces(uint256 tokenId) external view returns (uint256);

/**
* @notice `EIP-4494` permit to approve by way of owner signature.
*/
Expand Down Expand Up @@ -156,6 +165,19 @@ abstract contract PermitERC721 is ERC721, IPermit {
_approve(spender_, tokenId_);
}

/**
* @notice Query if a contract implements an interface.
* @param interfaceId The interface identifier.
* @return `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise
*/
function supportsInterface(
bytes4 interfaceId
) public view virtual override returns (bool) {
return
interfaceId == type(IPermit).interfaceId || // 0x5604e225
super.supportsInterface(interfaceId);
}

/**************************/
/*** Internal Functions ***/
/**************************/
Expand Down

0 comments on commit 61470bf

Please sign in to comment.