Skip to content

Using the Move Code Editor panel

Arora edited this page Mar 21, 2021 · 2 revisions

Using the Move Code Editor panel

The Move Code Editor panel allows users to create their own custom move code, use the code defined by their model, and create their FSM model by the code defined in the editor.

empty_panel

The code editor is set for Rust syntax highlighting, similar to how Diem has it.

An example of syntax highlighting for Rust: SyntaxHighlight

To view saved code, the user can start writing code into the editor and click SAVE CODE. This will add a new attribute to the contract model (seen on the right-hand side in the property editor panel). The code will be saved here and can be reaccessed from the VIEW SAVED CODE button.

SaveCode viewSavedCode

If you have an FSM model defined in the Model Editor panel, running the MoveCodeGenerator plugin will generate the Move code based on the model and that can be accessed using the VIEW GENERATED CODE button. Remember to click SAVE CODE afterward so that the customMoveCode attribute can be correctly updated.

To build the FSM based on the code in the move code editor, just save the code (so the customMoveCode attribute is updated) and run the FSMGenerator plugin. Then navigate back to the Model Editor panel and view your new FSM model.

Plugins are found in the image below: plugins