question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable `supportsInterface(...)` from ERC165 on ERC20 contract implementation

See original GitHub issue

🧐 Motivation

In the current token implementations of OpenZeppelin contracts, only the ERC721 implementation contains the supportsInterface(...) function.

ERC20 does not contain supportsInterface(...) by default.

I am not sure why this is the case, but my first guess would be the order that each of these ERC20 came up?

Looking at ERC721 specs, ERC165 is mentioned but not in the formal ERC20 specs.

📝 Details

Would it make sense to add supportsInterface(...) in ERC20, and make the contract inherit from ERC165 as well? So that by default, both fungible and non-fungible tokens implementation from OZ library can be detected easily via this function?

Let me know your thoughts @frangio @Amxx and I would be happy to make a brief PR if this feature request is accepted.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TrejGuncommented, Jul 26, 2022

@Amxx This would be a good start to make it a “best practice” to include supportsInterface into ERC20 if OZ does it.

I honestly would also include erc223 too

0reactions
Pandapip1commented, Aug 6, 2022

Yea, I would like to see an EIP-1363 implementation, but a new issue should be created for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introspection - OpenZeppelin Docs
Implementers can declare support of contract interfaces, which can then be queried by others ( ERC165Checker ). For an implementation, see ERC165 ....
Read more >
supportsInterface reverts without message when address ...
A way is to isContract to detect EOA and then use try/catch for contracts require(isContract(to), "Not a contract"); try IERC165(to).
Read more >
Ethereum Tokens: ERC165 (smart contract interfaces)
FREE TRAININGS (WEB3 DEV, FLASH LOANS...) How to find your first 6-Figures Blockchain Developer Job: https://bit.ly/390ebTq Learn how to ......
Read more >
Ethereum Standard ERC165 Explained | by Leo Zhang
For StoreInterface, it's 0x75b24222. OK. Let's implement the supportsInterface function for our Store contract: // Store.solpragma solidity 0.5.
Read more >
ERC-165: Detect What interfaces A Smart Contract Implements
For some “standard interfaces” like the ERC-20 token interface, ... Therefore the implementing contract will have a supportsInterface function that returns:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found