August 2019
Intermediate to advanced
486 pages
13h 52m
English
In a state machine, the initial state and the final state are known for the machine/process. Between these two states, there could be more intermediate states. In each state, different behaviors or functions are allowed on the machine. For example, a vending machine is a state machine, in which it first asks for the user to select the item number, and, once selected, it moves to the collect amount state. Once the amount is paid by the user, it dispenses the item requested by the user and, at last, the process ends.
The state machine pattern allows a contract to transition from different states and enables certain functions to be executed in each state.
A Solidity contract can be designed in such a way that it represents ...