StateMutability enum
The state mutability of a contract function defines how that function interacts with the blockchain.
Functions whose mutability is either pure or view promise to not write data to the blockchain. This allows Ethereum nodes to execute them locally instead of sending a transaction for the invocation. That in turn makes them free to use. Mutable functions, like nonPayable or payable may write to the blockchain, which means that they can only be executed as part of a transaction, which has gas costs.
Values
- pure → const StateMutability
-
Function whose output depends solely on it's input. It does not ready any state from the blockchain.
- view → const StateMutability
-
Function that reads from the blockchain, but doesn't write to it.
- nonPayable → const StateMutability
-
Function that may write to the blockchain, but doesn't accept any Ether.
- payable → const StateMutability
-
Function that may write to the blockchain and additionally accepts Ether.
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
StateMutability> - A constant List of the values in this enum, in order of their declaration.