Skip to content

Creating an FSM from Move code

Arora edited this page Mar 21, 2021 · 4 revisions

Creating an FSM from Move code

The FSMGenerator plugin uses the code inside the customMoveCode attribute of the model to create the FSM. The plugin will go into the Model Editor panel and remove all the nodes already in the panel (clear the panel) and then create an initial state and a base state as well as a createTransition transition from the initial state to the base state. The functions defined in the code will then be used as transitions to loop back the base state.

An example process is as follows:

  1. Note the empty contract (the model editor can either be empty or have previous nodes the plugin will delete whatever is already in the model editor panel)
empty_contract
  1. Ensure there is a customMoveCode attribute in the contract by clicking save code in the Move Code Editor panel with the correct code being displayed.
saved_code
  1. Click on the GenerateFSM plugin
fsm_gen_plugin
  1. Click Run... to activate the plugin
fsm_gen_run
  1. Navigate back to the Model Editor panel to view the newly created FSM
generated_model