Data Entities
Last updated
Last updated
Data Entities are an umbrella term for simple or complex variables to be used in a Contract and its Functions. When defined in the leftbar, data entities are global, meaning that they can be accessed (and modified) by any of the contract's functions.
Assign a specific and descriptive name to your data entity. This name helps to infer the data entity's purpose and distinguish it from others. Additionally, the name will be used as a keyword in the code, so choose a name that clearly indicates the data entity's function.
Select a Data Entity Type among all available types in Solidity. This selection will specialize the data entity so to access the dedicated properties. Then you can define the storage location of a Data Entity. This will affect how (and whether) the Data Entity is stored in the contract's storage.
Simple: A Simple Data Entity is used to hold basic types such as numbers, booleans, and strings.
State: Determines if the data entity's value can be modified after assignment.
Constant: Cannot be changed after compilation.
Immutable: Can be set within a constructor but not modified afterwards.
Subtype: Specifies the type of data the entity is storing.
This setup helps manage basic data types within your smart contract efficiently.
Array: The Array Type determines what type of Data Entities are stored in the array. Arrays can hold only a single type of data entity.
Struct: A Struct Data Entity is a data structure that combines different data types.
Name: Identifies the subsets of variables grouped within the struct.
Usage: Once defined and instantiated, any of the struct's data types can be assigned a value or accessed.
This allows for the organization and management of complex data within your smart contract.
Select an existing Struct (this is used when you want to instance a Struct following an already defined one).
Create a new Property (this is used to define Structs)
Array of Structs: Select an already defined Struct Data Entity for this Array.
Enum: An Enum values define a set of predefined constants that can be used for several purposes, such as checking whether a variable name is among them.
Mapping: A Data Entity Mapping is use to create a Solidity mapping. In Solidity, mappings function similarly to a dictionary or hash table in another language. These are used to store data in the form of key-value pairs, with the value being able to be of any type and the key being any of the built-in data types, but reference types (i.e. Structs, Arrays) are not permitted to be used as keys.
Define the Type for the Mapping's Key
Define the Type for the Mapping's Value
Select an existing Mapping (this is used when you want to instance a Mapping following an already defined one)
Mapping of Structs: A Mapping of Structs is use to create a Solidity mapping where the mapping's values are structs. In Solidity, mappings function similarly to a dictionary or hash table in another language. These are used to store data in the form of key-value pairs, with the value being able to be of any type and the key being any of the built-in data types, but reference types (i.e. structs, arrays) are not permitted to be used as keys.
Define the Mapping's Key type
Define the Struct used as Mapping Value
Select an existing Mapping of Structs (this is used when you want to instance a Mapping following an already defined one)
Free Input: A Free Input Data Entity is used to create a Data Entity with a custom value.
The Type determines the type of data for this Free Input Data Entity. Naturally, this will also affect the kind of custom value that can be assigned to the data entity.
This field defines the custom value that is assigned to this Free Input Data Entity.
Pointer: Data Entity Pointer is used to point to structure's property or to a mapping property.
DataEntitySpecial: DataEntitySpecial Component: Defines special data entities like msg.sender, msg.data, and msg.value for use in smart contracts, providing attributes for customization and linkage to other contract components.