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.
Condition Type: Determines the behavior of the condition in the flow.
If: A traditional condition that splits the flow into two subflows based on whether the condition is met.
Assert: Tests for internal errors and checks invariants. It does not throw an error message and should be used like an exception.
Require: Checks for validity before execution, typically for input validity, and can throw an error message if the condition is not met.
Define the condition using a dedicated operation. Specify which element the flow should 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 Instantiation Element is used to instantiate a Data Entity. This typically involves defining and creating a new data entity. For structs, you can refer to an already defined struct and instantiate it using this element.
Define or Select Data Entity: Specify which Data Entity should be instantiated.
Create and Define Operation: Perform an operation on the newly instantiated Data Entity, such as immediately assigning it a value.
This setup allows you to efficiently manage the creation and initialization of data entities within your smart contract.
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, either a custom function or one from an import, within the current flow.
Select Function: Choose the function you want to call.
Input Mapping: Ensure that compatible data entities are present in the flow to provide the required inputs. Map these inputs to the corresponding data entities.
Return Mapping: Map the return value of the function to a compatible data entity.
Deployed Contract Address: If the function is from an already deployed contract, specify the contract's address.
This setup allows you to seamlessly integrate and utilize existing functions within your smart contract flow.
Ledger Transaction
Select the type of transaction you want to perform:
Delete: Remove an existing data entity.
Init: Initialize a new data entity.
Insert: Add a new entry to a data structure.
Query: Retrieve data from a data structure.
Update: Modify an existing data entity.
This selection allows you to specify the desired transaction type for your operation within the smart contract.
Loop
The Loop Element is used to create a sequence of instructions that repeat until a specified condition is met.
Create Condition: Define the condition that will determine when the loop ends. The loop will continue until this condition is met.
Select Loop Type: Choose the type of loop:
Array: Iterate over elements in an array.
Conditional: Repeat based on a specified condition.
Iterator: Use an iterator to control the loop.
Select Function: Choose a function to execute as the logic for the loop. This function will be continually repeated until the loop's condition is satisfied.
This setup allows for the repetitive execution of instructions within your smart contract, providing flexibility and control over the contract's behavior.
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