0

I don't understand solidity events at all. For example: https://rinkeby.etherscan.io/address/0xc5a79064168c0aa3706c33d70b94a09103e9656b#events Some events show its names, others show methods without names and others show only data. Althought, I created similar events. Why it happens? Is it a problem if some events don't show it methods and names or it's normal in development?

1

Basically, each event contains up to 5 "topics", plus arbitrary binary payload. By convention, first topic is an address of a smart contract that logged the event. Second topic is a keccak256 hash of event's signature, i.e. string looking like OwnershipTransferred(address,address). Three other topics are for indexed parameters of the event, and binary payload is for non-indexed parameters. Event topics by themselves do not contain event name or any other human-readable information in open form. Though, in case etherscan has source code of a smart contract, it can calculate keccak256 hashes of signatures of declared events, and thus decrypt the second topics. What you think are methods, actually are events with parameters.

  • Thanks a lot! I didn't understand how etherscan decrypt events and I got the answer. Thank you! – Aleksandr Apr 22 at 6:43
0

The source code is not verified.

Look at other smart contracts that have verified source code. Then look at their events.

Example here: https://rinkeby.etherscan.io/address/0x54a298ee9fccbf0ad8e55bc641d3086b81a48c41#events

  • Honestly, I'm newbie and I don't see any difference with my code. I define the event in the contract and then emit it in the function. Does there any other important steps for using? USDC, for example, doesn't show names of events. And how is it important to write down events correctly? – Aleksandr Mar 18 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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