-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement eip-165 for dapps #159
Conversation
@@ -17,7 +20,7 @@ struct Proof { | |||
} | |||
|
|||
/// @title Cartesi DApp interface | |||
interface ICartesiDApp { | |||
interface ICartesiDApp is IERC721Receiver, IERC1155Receiver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurred to me that we should inherit from IERC721Receiver
and IERC1155Receiver
as well. So users can more easily detect that the dapp implemented receivers for ERC721 and ERC1155.
And IERC1155Receiver
inherits from IERC165
so we don't need to.
@@ -11,9 +11,11 @@ import {Bitmask} from "@cartesi/util/contracts/Bitmask.sol"; | |||
|
|||
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; | |||
import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; | |||
import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; | |||
import {ERC1155Holder, ERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the newer versions of openzeppelin, ERC1155Receiver
is merged into ERC1155Holder
, and thus ERC1155Receiver
is deprecated.
@@ -114,6 +116,15 @@ contract CartesiDApp is | |||
_consensus.join(); | |||
} | |||
|
|||
function supportsInterface( | |||
bytes4 interfaceId | |||
) public view virtual override(ERC1155Receiver, IERC165) returns (bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we upgrade openzeppelin, this function would be overriding ERC1155Holder
rather than ERC1155Receiver
You don't need to make |
But |
bc88fa1
to
421085e
Compare
Implemented EIP-165 for CartesiDApp contract. | ||
Also updated ICartesiDApp to include IERC721Receiver, IERC1155Receiver (which inherits from IERC165). | ||
We implemented EIP-165 so that it would be more convenient to detect a potential CartesDApp instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format contract names as code.
Implemented EIP-165 for CartesiDApp contract. | |
Also updated ICartesiDApp to include IERC721Receiver, IERC1155Receiver (which inherits from IERC165). | |
We implemented EIP-165 so that it would be more convenient to detect a potential CartesDApp instance. | |
Implemented EIP-165 for CartesiDApp contract. | |
Also updated `ICartesiDApp` to include `IERC721Receiver`, `IERC1155Receiver` (which inherits from `IERC165`). | |
We made the `ICartesiDApp` interface inherit from `ERC165` so that it would be possible to detect contracts that do not support such interface. |
421085e
to
9e0111e
Compare
No description provided.