Code Monkey home page Code Monkey logo

Comments (2)

xf00f avatar xf00f commented on June 7, 2024 1

@AlexCheema This is an interesting issue you've uncovered.
The problem is not a missing topic exactly. Only indexed parameters are topics.
You call an ERC721 contract. The interface defines the Transfer event as follows.

event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

Your ERC721 contract then calls an ERC20 contract which creates a Transfer event with signature:

event Transfer(address indexed from, address indexed to, uint256 value);

These are two separate events. Normally, the fact that each event has its own signature, would mean the log created by the called contract would not have a matching signature, and it would be treated as an anonymous event. This is the correct and expected behaviour in this case. However, both of these events have their signature derived from the standardised signature format resulting in Transfer(address,address,uint256), and thus their signatures match.

The client code then attempts to parse the ERC20 Transfer event as a ERC721 Transfer event, and a topic is missing because the ERC20 event does not have an indexed value.

I think you are incorrectly expecting a log event of one type to be exposed as another type. The best you can hope for here is an anonymous event, otherwise you would end up with a value in a tokenId.

Regardless, there does seem to be a library issue in that it is parsing an event from one contract as if it belongs to another. I believe the solution is check that any returned logs belong to the current contract and if not they must be treated anonymous.

I will try and fix this shortly.

from web3x.

xf00f avatar xf00f commented on June 7, 2024

@AlexCheema v3.0.3 should fix your problem

Given the test case above, you will find that there are no events because TransferBug does not generate any events. The raw event log generated by the ERC20 token call will be in a field named anonymousLogs.

Hope this solves your problem.

from web3x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.