0

The value of aggregatorId in the event emitted by the below tx is not equal to value “oneInchV5FeeDynamic” in the tx? Also, I can’t decode the value emitted in the event “0xf35f348d53012d52a5d39f9390d246956ac932d5778d2bb49e359dba4fa0896d” into a string using eth_abi abi.decode method.
The below method also returns value "0xf35f348d53012d52a5d39f9390d246956ac932d5778d2bb49e359dba4fa0896d".

processed_log = contract.events.myEvent().process_log(log_to_process)

The hex equivalent of string value “oneInchV5FeeDynamic” is “0x6f6e65496e6368563546656544796e616d6963”, which is not same as event emitted value.
Can anyone explain this?

Decoded tx data

Name | Type | Data
aggregatorId | string | oneInchV5FeeDynamic |
tokenFrom | address | 0xA9E8aCf069C58aEc8825542845Fd754e41a9489A |
amount | uint256 | 1891980133455368475347 |
data | bytes | 0x000000000000000000000000a9e8acf06… |

Emitted event

Name Swap (index_topic_1 string aggregatorId, index_topic_2 address sender)

Topics
0 - 0xbeee1e6e7fe307ddcf84b0a16137a4430ad5e2480fc4f4a8e250ab56ccd7630d
1 - 0xf35f348d53012d52a5d39f9390d246956ac932d5778d2bb49e359dba4fa0896d (value of aggregatorId)
2 - 0x748dF7c92687A7acA7c1ac81b1cDC2A3995581b9\

1 Answer 1

0

If the topic is of string type, the string value returned by the log is keccak256(bytes("oneInchV5FeeDynamic")). Try not to mark strings as topics.

1
  • I am working on a tool that uses static analysis to extract the complete state of the Solidity smart contract. And I have noticed that many "Router" contracts do this, and I am facing issues in getting value of mapping key from event's indexed string parameter. This tx is of MetaSwap (Metamask: Swap Router) smart contract. etherscan.io/tx/…
    – Waiz Khan
    Oct 26, 2023 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.