Declaring Events
Emit on-chain logs.
What Are Events?
Events let a smart contract write entries to the blockchain's log. These logs are a cheap way to record that something happened and are the primary channel for contracts to communicate with off-chain applications.
Front-ends, indexers, and analytics tools all listen for events.
Declaring an Event
You declare an event with the event keyword and a list of typed parameters. The declaration defines the event's shape.
<code>event Transfer(address from, address to, uint256 amount);</code>All lessons in this course
- Declaring Events
- Indexed Parameters
- Listening for Events
- Events vs Storage