In this example Traffic Light task is a simple state machine which has it's own state transition rules in calldata that executes by vm on each task's instructions call.

VM has persistent storage, so state is persistent across calls

Calldata logic: check task's state -> transit to next -> save. State transition rule: 0(Green)->1(Yellow)->2(Red)->0(Green).

examples code: https://github.com/tracyspacy/spacydo/blob/main/examples/traffic_light