August 2018
Intermediate to advanced
404 pages
11h 19m
English
Follow these steps to create and emit events from the contract:
event Transfer( address _from, address _to, uint _value);
function transfer(address _to, uint _value) public { // Function body emit Transfer(msg.sender, _to, _value);}
Up to three parameters can be indexed in an event. We can use indexed parameters to filter events based on requirements. If arrays, strings, or bytes are used as indexed arguments, the Keccak-256 hash of it is stored as a topic:
event Transfer( address indexed _from, address indexed _to, uint _value);