Simple Summary
Support the use of @pure as a decorator for methods
Motivation
To be consistent with the ABI stateMutability field, we should add support for specifying a method as @pure.
Specification
A method that is decorated as @pure must not read any blockchain state such as storage variables, environment variables, querying contract code or account balances, or making a call to nonpure methods, or to other contracts. In the event this happens, this should raise an exception that uniquely details a violation of reading blockchain state. Such a function might be useful for complex math or other purposes.
A method decorated with @pure looks like:
@pure
@public
def getMaff() -> uint256:
return 1 + 2
Backwards Compatibility
No backwards compatibility issues
Dependencies
No dependencies. Related to #2040
References
Copyright
Copyright and related rights waived via CC0
Simple Summary
Support the use of
@pureas a decorator for methodsMotivation
To be consistent with the ABI
stateMutabilityfield, we should add support for specifying a method as@pure.Specification
A method that is decorated as
@puremust not read any blockchain state such as storage variables, environment variables, querying contract code or account balances, or making a call to nonpuremethods, or to other contracts. In the event this happens, this should raise an exception that uniquely details a violation of reading blockchain state. Such a function might be useful for complex math or other purposes.A method decorated with
@purelooks like:Backwards Compatibility
No backwards compatibility issues
Dependencies
No dependencies. Related to #2040
References
Copyright
Copyright and related rights waived via CC0