Skip to content

Commit

Permalink
feat: support EIP165 interface
Browse files Browse the repository at this point in the history
  • Loading branch information
smol-ninja committed Nov 11, 2024
1 parent 8b32598 commit 89edff6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/abstracts/SablierFlowBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import { UD21x18 } from "@prb/math/src/UD21x18.sol";
import { UD60x18 } from "@prb/math/src/UD60x18.sol";

Expand Down Expand Up @@ -283,6 +284,12 @@ abstract contract SablierFlowBase is
emit BatchMetadataUpdate({ _fromTokenId: 1, _toTokenId: nextStreamId - 1 });
}

/// @inheritdoc ERC721
function supportsInterface(bytes4 interfaceId) public view override(IERC165, ERC721) returns (bool) {
// 0x49064906 is the ERC-165 interface ID required by ERC-4906
return interfaceId == 0x49064906 || super.supportsInterface(interfaceId);
}

/*//////////////////////////////////////////////////////////////////////////
INTERNAL CONSTANT FUNCTIONS
//////////////////////////////////////////////////////////////////////////*/
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/concrete/constructor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ contract Constructor_Integration_Concrete_Test is Integration_Test {
address expectedAdmin = users.admin;
assertEq(actualAdmin, expectedAdmin, "admin");

// {SablierV2Lockup.supportsInterface}
assertTrue(constructedFlow.supportsInterface(0x49064906), "ERC-4906 interface ID");

address actualNFTDescriptor = address(constructedFlow.nftDescriptor());
address expectedNFTDescriptor = address(nftDescriptor);
assertEq(actualNFTDescriptor, expectedNFTDescriptor, "nftDescriptor");
Expand Down

0 comments on commit 89edff6

Please sign in to comment.