Events
Orbs contract events give you the ability to log information into the blockchain that is stored as part of the receipt block.
Here is a simple contract that emits an event. We will go over it in details:
Using the Events API require you first to import it:
Next, we export the event:
Then we declare it as an empty function. Note that the empty bracers are required ({}
):
When the function giveBirth(name string)
is called, we want the event to be emitted, so we call the events.EmitEvent
function:
The arguments are a pointer to the event function (which is also exported) and the event arguments.
Last updated