Events

Syntax
Event :
   event IDENTIFIER : NEWLINE
   INDENT
   EventField*
   DEDENT

EventField :
   EventIndexability IDENTIFIER : Type

EventIndexability :
   idx?

An event is a nominal event type defined with the keyword event. It is emitted with the keyword emit.

An example of a event item and its use:

contract Foo:
    event Transfer:
        idx sender: address
        idx receiver: address
        value: u256

    fn transfer(to : address, value : u256):
        # Heavy logic here
        # All done, log the event for listeners
        emit Transfer(sender=msg.sender, receiver=to, value)