Variables are stored in one of three places.
storage
- variable is a state variable (store on blockchain)memory
- variable is in memory and it exists temporary during a function callcalldata
- special data location that contains function argumentsmemory
and calldata
calldata
is like memory
but not modifiable. calldata
saves gas.
Unless we internally keep track of all the keys in the mapping
Why we have to index events?
logging data on the blockchain ⇒ it IS a transaction and cannot be declared as view function
if you want to search for an event by the parameter that was logged, then we use the keyword indexed