Solidity Pure Functions Main Tips
- In Solidity pure functions are functions, that are promised not to modify or read the state.
- This feature is not enforced yet, meaning that technically, they can still do anything a normal function can.
Solidity Pure Functions
In Solidity pure functions are functions, that are promised not to modify or read the state.
In addition to modifying the state, (defined in the tutorial on view functions) they also cannot read from the state.
The list below contains conditions for a function to be considered to be “reading from the state”:
- State variable being read.
- <address>.balance or this.balance being accessed.
- Members of msg, tx, block being accessed (except for msg.sig and msg.data).
- Functions that are not marked pure being called.
- Inline assembly containing certain opcodes being used.