LOG0 - LOG4

LOG0 is an EVM opcode that was used in earlier versions of Solidity to log an event with a single indexed parameter. In newer versions of Solidity, events are used to emit logs and provide a more user-friendly way to log events.

The indexed keyword in an event declaration allows one or more of the event parameters to be indexed. This enables efficient filtering of events based on the indexed parameters, which can be useful for searching and filtering through large numbers of logs. Additionally, indexed parameters can be used to link related events together in a more meaningful way.

Under the hood, Solidity still generates EVM bytecode that logs events using the LOG1, LOG2, LOG3, and LOG4 opcodes, depending on the number of indexed parameters and the size of the event data. However, developers typically interact with events in Solidity using the emit keyword and the event interface generated by the contract compiler.

Last updated