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.

OperationStruct

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

Last updated