EthTx / ethtx

Python package with core transaction decoding functions.
https://www.ethtx.info
Apache License 2.0
454 stars 73 forks source link

Chainlink has incorrect balance #195

Open bromulous opened 1 year ago

bromulous commented 1 year ago

Chainlink uses a slightly different erc20 transfer signature which breaks how many tokens it thinks were transferred. Compare https://ethtx.info/mainnet/0xbaf08c360fc8f6098adbe2c7c3612106432123397dd2d5b84d042c1786261207/

Screenshot 2023-08-11 at 6 00 15 PM

https://etherscan.io/tx/0xbaf08c360fc8f6098adbe2c7c3612106432123397dd2d5b84d042c1786261207

Screenshot 2023-08-11 at 6 00 33 PM

Potential Solution Add in an additional signature to look for. In erc20.py add erc20_modified_transfer_event = EventSemantics( signature="0xe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16", anonymous=False, name="Transfer", parameters=[ ParameterSemantics( parameter_name="src", parameter_type="address", indexed=True ), ParameterSemantics( parameter_name="dst", parameter_type="address", indexed=True ), ParameterSemantics( parameter_name="value", parameter_type="uint256", indexed=False ), ParameterSemantics( parameter_name="data", parameter_type="bytes", indexed=False,dynamic=True ), ], ) and ERC20_MODIFIED_EVENTS = { erc20_modified_transfer_event.signature: erc20_modified_transfer_event, erc20_approval_event.signature: erc20_approval_event, }

And then in repository.py modify line 214 from if all(erc20_event in events for erc20_event in ERC20_EVENTS) and all( to if (all(erc20_event in events for erc20_event in ERC20_EVENTS) or all(erc20_event in events for erc20_event in ERC20_MODIFIED_EVENTS)) and all(

This will pull the correct balance:

Screenshot 2023-08-11 at 6 06 37 PM

I don't know if this is where you actually want to put it but it does solve the issue. I can submit a pull request if you'd like.

bromulous commented 1 year ago

Pull request https://github.com/EthTx/ethtx/pull/196