Custom types like structs, enums, and unions are also supported. See Custom Types.
The following primitive types are supported:
Unsigned 32-bit Integer (
Signed 32-bit Integer (
Unsigned 64-bit Integer (
Signed 64-bit Integer (
Unsigned 128-bit Integer (
Signed 128-bit Integer (
Symbols are small efficient strings up to 32 characters in length and limited to
_ that are encoded into 64-bit integers.
Symbols are primarily used for function names and other identifiers that are exported in the public API of a contract. They can also be used wherever short strings are needed to keep resource costs down.
Bytes, Strings (
Byte arrays and strings can be passed to contracts and stores using the
For byte arrays of fixed length,
BytesN can be used. For example, contract IDs
are fixed 32-byte byte arrays, and are represented as
Vec is a sequential and indexable growable collection type.
Values are stored in the environment and are available to contract through the functions defined on Vec. Values stored in the Vec are transmitted to the environment as RawVals, and when retrieved from the Vec are transmitted back and converted from RawVal back into their type.
The values in a Vec are not guaranteed to be of any specific type and conversion will fail if they are not of the expected type. Most functions on Vec return a Result due to this.
Map is a ordered key-value dictionary.
The map is ordered by its keys. Iterating a map is stable and always returns the keys and values in order of the keys.
The map is stored in the Host and available to the Guest through the functions defined on Map. Values stored in the Map are transmitted to the Host as RawVals, and when retrieved from the Map are transmitted back and converted from RawVal back into their type.
The keys and values in a Map are not guaranteed to be of type K/V and conversion will fail if they are not. Most functions on Map return a Result due to this.
Maps have at most one entry per key. Setting a value for a key in the map that already has a value for that key replaces the value.
Address is a universal opaque identifier to use in contracts. It may represent a 'classic' Stellar account, a custom account implemented in Soroban or just an arbitrary contract.
Address can be used as a contract function input argument (for example, to identify the payment recipient), as a data key (for example, to store the balance), as the authentication & authorization source (for example, to authorize a token transfer) etc.
See authorization documentation for more details on how to