...by Daniel Szego
quote
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Monday, April 2, 2018

Solidity Tips and Tricks - indexed keyword


You may have seen the indexed keyword in some of the events in solidity, lie :

event Transfer(address indexed _from, address indexed _to, uint256 _amount);

It can be used only in events and has a meaning only outside solidity, like from javascript. If indexed value was used, the event log can be filtered, like with a statement:

var event = contract.Transfer({}, {fromBlock:startingBlock, toBlock: startingBlock + 2000});