Skip to content

Interface parseLog throws error #3220

Answered by ricmoo
iphyman asked this question in Q&A
Jul 31, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Unfortunately, because Solidity does not include the indexed keyword when computing topic hashes, the ERC-20 and ERC-721 Transfer events share the identical topic hash.

As a result, a filter for one will also get the other, and they are incompatible (as ERC-721 indexes the tokenId and ERC-20 does not index the equivalent field amount).

If you have a contract that emits both, you will need to further refine by some other method, such as by topic length or the presence of data. You can also trap errors and possibly discard them, depending on your use case.

Does that make sense? It would have been nice if ERC-721 also didn’t try to be compatible with ERC-20. :s

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@iphyman
Comment options

@ancil-t
Comment options

@ChrisCates
Comment options

Answer selected by iphyman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #3219 on July 31, 2022 20:41.