Operations

Introduction

Operations allow to manipulate the value of a Data Entity, or of a property of a Data Entity.

Configuration

The type of an operation specifies the functionality of the component. Currently, you can perform five types of operations:

  • Array Operations

  • Assign Operations

  • Math Operations

  • Condition Operations

  • String Operations

  • OperationEnum

  • OperationStruct

Each operation type allows you to handle specific tasks within your smart contract, providing flexibility and control over the contract's behavior.

Array Operations

An Array Operation is used to manipulate arrays. Alongside the primary scope defined in the Data Manipulation Element, an Array Operation includes one Term and an Operator:

  • Term: Specifies the Data Entity to be used in the Array Operation.

  • Operator: Defines the type of operation to be performed:

    • Pop: Removes the Data Entity specified as the term from the array.

    • Push: Adds the Data Entity specified as the term to the array.

This setup allows you to efficiently manage and manipulate arrays within your smart contract.

Assign Operation

An Assign Operation is utilized to change the value of a suitable Data Entity by assigning it another data entity's value. The Mapping defines what Data Entity should be used to assign the value to the data entity in the Manipulation's primary scope.

Math Operation

A Math Operation is used to perform numerical operations on suitable data entities. Alongside the primary scope defined in the Data Manipulation Element, a Math Operation includes two Terms and an Operator:

  • First Term: Specifies the Data Entity to be used as the left-hand side of the Math Operation.

  • Second Term: Specifies the Data Entity to be used as the right-hand side of the Math Operation.

  • Operator: Defines the type of mathematical operation to be performed between the two terms. There are four possible operators:

    • Add: Performs addition.

    • Subtract: Performs subtraction.

    • Divide: Performs division.

    • Multiply: Performs multiplication.

This setup allows you to execute various mathematical operations within your smart contract efficiently.

Condition Operation

A Condition Operation is used to define conditions within your smart contract. It involves two Terms and an Operator:

  • First Term: Specifies the Data Entity to be used as the left-hand side of the Condition Operation.

  • Second Term: Specifies the Data Entity to be used as the right-hand side of the Condition Operation.

  • Operator: Defines the type of comparison performed between the two terms. The available operators are:

    • Less Than

    • Greater Than

    • Equal

    • Less Than or Equal

    • Greater Than or Equal

    • Not Equal

This setup allows you to define precise conditions and comparisons within your smart contract.

String Operation

A String Operation is used to manipulate strings. Alongside the primary scope defined in the Data Manipulation Element, a String Operation includes two Terms and an Operator:

  • First Term: Specifies the Data Entity to be used as the left-hand side of the String Operation.

  • Second Term: Specifies the Data Entity to be used as the right-hand side of the String Operation.

  • Operator: Defines the type of operation performed between the two terms. The available operator is:

    • Concatenate: Appends the values of the two strings, placing the second string after the first.

This setup allows you to effectively manage and combine string values within your smart contract.

OperationEnum

Defines operations on enumeration values within Solidity smart contracts by referencing a DataEntityFreeInput instance. This component allows you to specify the enum value and its associated operation type, integrating seamlessly with other contract elements.

  1. Reference DataEntityFreeInput: Select the DataEntityFreeInput instance to be used for the enumeration operation.

  2. Specify Enum Value: Define the enum value to be used in the operation.

  3. Operation Type: Select the type of operation to be performed on the enum value.

By using this component, you can effectively manage and manipulate enumeration values within your smart contract, ensuring smooth integration with other contract elements.

OperationStruct

Manages operations on struct mappings within Solidity smart contracts by referencing multiple Mapping components. This component allows you to specify the struct mappings and the operation type, facilitating complex data structure manipulations within the contract.

  1. Reference Mapping Components: Select the Mapping components that define the struct mappings to be used.

  2. Specify Operation Type: Define the type of operation to be performed on the struct mappings, such as adding, updating, or removing entries.

By using this component, you can efficiently manage and manipulate struct mappings, enabling complex data structure operations within your smart contract.

Last updated