emit statement

EmitStatement :
   emit EventLiteral ( CallParams? )

EventLiteral :
   IDENTIFIERName of event defined in current module

CallParams :
   CallArg ( , CallArg )* ,?

CallArg :
   (CallArgLabel :)? Expression

CallArgLabel :
   IDENTIFIERLabel must correspond to the name of the event property at the given position. It can be omitted if parameter name and event property name are equal.

The emit statement is used to create log entries in the blockchain. The emit keyword is followed by a literal that corresponds to a defined event, followed by a parenthesized comma-separated list of expressions.


use std::context::Context

contract Foo {
    event Mix {
        num1: u256
        idx addr: address
        num2: u256
        my_bytes: Array<u8, 100>
    pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array<u8, 100>) {
        emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes)