How is Harmony extracting "Suggested Event" from transaction logs

I’m extracting data from Log events but many do not follow the ERC20 standard ABI.

For example the logs in this transaction - If I try to decode the log with web3 AbiCoder.decodeLog(...) and use the ERC20 ABI it fails. But when I review the log on the Harmony Block Explorer (linked above) it shows:
Suggested Event: Approval(address,address,uint256)
Suggested Event: Transfer(address,address,uint256)
…etc

How is it abstracting this data? Are the ABI’s published somewhere for those contracts? Any help appreciated.

1 Like

If a contracts publishes is abi it will be on

explorer.harmony.one under the contract tab

Other than that, you can search the github and compile the contract to get the abi.

Can you programmatically get the ABI for the contract with an API request? I’d like to avoid manually grabbing every ABI or writing a scraper. I think I’m also curious how harmony is writing the logic for Suggested Event

The only way to get an ABI is if it is published on the explorer.

You can try directly connecting to the api via

https://ctrver.t.hmny.io/fetchContractCode?contractAddress=CONTRACT_ADDRESS

For Example:

HEX:

https://ctrver.t.hmny.io/fetchContractCode?contractAddress=0xb5024ff84046459Dd8474077e6072A05E34E82cd

OR

BECH32:

https://ctrver.t.hmny.io/fetchContractCode?contractAddress=one1k5pyl7zqgezemkz8gpm7vpe2qh35aqkd5kszg4

Example Python Code:

https://github.com/johnashu/web3_base/blob/3b2c654fbb873d5ac8c5bb1d3400d3bd60378bfc/web3_base.py#L34

You will get the ABI AND the full contract code if it exists…

This is great, thank you! The example I posted uses this contract address 0x5f753dcdf9b1ad9aabc1346614d1f4746fd6ce5c

It seems like it’s published to Harmony here but the API returns Contract not found. Any thoughts? Does it need to be verified or did I misread the contract wrong on Harmony

My post was flagged and now I can’t reply with links?

1 Like

I got this DM lol…

Hello,

This is an automated message from Harmony Community Forum to let you know that your post was hidden.

https://talk.harmony.one/t/is-anyone-using-filters-with-the-harmony-api/6642/2

Your post was flagged as spam : the community feels it is an advertisement, something that is overly promotional in nature instead of being useful or relevant to the topic as expected.

This post was hidden due to flags from the community, so please consider how you might revise your post to reflect their feedback. You can edit your post after 10 minutes, and it will be automatically unhidden.

However, if the post is hidden by the community a second time, it will remain hidden until handled by staff.

For additional guidance, please refer to our community guidelines.

Must be some mistake>??

You can DM if you like…

You can look up event IDs in the 4byte.directory to get suggested events. AFAIK that’s how the explorer does it