Elements

Introduction

Elements can be added on the metamodel design by clicking the + on the functions. An element's name is used to name and differentiate elements. It is advised that the name be specific and descriptive enough to be able to infer the element's functionality and distinguish it from other similar elements.

Configuration

Condition

The Condition Element is used to create a condition in the flow of a smart contract. A Condition's Type is used to determine the behavior of the condition in the flow. An 'if' condition is a traditional condition that splits the flow in two subflows according to whether the condition is met. The 'assert' and 'require' conditions are instead slightly different. The former is used to test for internal errors and check for invariants. It does not throw an error message and should as such only be used similarly to an exception. The latter instead is generally used to check for validity before execution, usually input validity, and it can throw an error message. Define the Condition via a dedicated Operation. Select which Element should the flow split to if the condition is not met (if the condition is met, the flow will continue to the next element) Select the Function you would like to call.

Data Entity Instantiation

The Data Entity Instatiation Element is used to instantiate a Data Entity. Generally this means that a new data entity is both defined and created, but in the case of structs for instance one can refer to an already defined struct and instantiate it via this element. Define or select which Data Entity should be instantiated by this Element. Create and Define an Operation to perform on the newly instantiated Data Entity. This can be used to immediately assign a value to the data entity.

Data Entity Manipulation

The Data Entity Manipulation Element is used to manipulate the value of an existing Data Entity. Define or select a Data Entity to manipulate with this Element. Define the Manipulation via a dedicated Operation.

Event Emission

The Event Emission Element is used to emit a predefined Event, either user-created or coming from an Import. EventCode: Select which Event should be emitted by this Element. Payload: Map currently existing Data Entities to the required Event Input.

Function Call

The Function Call Element is used to call an existing function (this can be either a custom function, or a function coming from an import) from the current flow. Select the Function you would like to call. Keep in mind that if the function needs input, compatible data entities should already be present in the flow in order for the input to be provided/mapped correctly. Map the Input required by this Function, if any, to compatible data entities available in this function's flow. Map the Return of the Function that is being called to a compatible data entity. If the Function that you would like to call is from an already deployed contract, you can use this field to specifiy the contract's address.

Ledger Transaction

Choose transaction type:

  • Delete

  • Init

  • Insert

  • Query

  • Update

Loop

The Loop Element is used to create a loop, i.e. a sequence of instructions that is continually repeated until a certain condition is reached. Create a Condition for the loop. The loop will continue until the condition is met. Select a type of loop: Array, Conditional, Iterator Then select a Function to be used as logic for this loop.

Return

The Return Element is used to specify a Data Entity to be returned by the function. In practice, this means that whenever this function is being called, it will return the specified data entity as the result of its execution. Define or select a Data Entity to be returned by this function.

Print

Message: Define a message to be printed

PrimaryScope: Define or select a Data Entity to be printed

Last updated