Solia saysAn on-chain state machine encodes lifecycle as an enum with explicit allowed transitions — making invalid moves revert instead of corrupting state silently.
Many protocols have lifecycle stages: an escrow goes Created → Funded → Active → Completed; an auction goes Open → Bidding → Settling → Closed. Encoding the stage as an explicit state machine on-chain — an enum plus a transition table — turns "did I forget to check?" bugs into hard reverts. Every state-mutating function checks the current state and the requested transition.
The pattern is verbose but auditable: anyone reading the contract sees exactly which transitions are legal. The demo walks Created → Funded → Active → Completed and tries an illegal transition.
Power-ups you unlock
Lifecycle encoded as an enum (Created / Funded / Active / …)