I need to write a contract. That contract should detect and alert while receiving token/ether with some parameter. If somebody sends token/ether with some parameter to my contract. I need to know at the time of the transaction received. Is any event available to do this function Thanks in advance
For this, you need to
- Write a function that emits a so called
- Events take parameters (the data you want to log). give the event a parameter of the type uint256 and put
msg.valueas that parameter when emitting the event.
- write a listener, that listens to the triggering of such events.
Examples for all of this can be found here: https://solidity.readthedocs.io/en/v0.5.3/contracts.html#events
Hint: If you put as
fromBlock: "latest" in your listener script, it will not search for events in the past, but only give you triggered events in "real time".