Types¶
ENI Types¶
These types are provided to be coherent with primitive types of Lity (Solidity).
ENI Integers¶
All integer types in ENI is implemented using boost::multiprecision::number. Some of them are aliases for types predefined in boost::multiprecision::cpp_int.
Integer Type | Size (bits) | Signed | Note |
---|---|---|---|
eni::s256 |
256 | ✔ | Alias for boost::multiprecision::int256_t . |
eni::Int |
256 | ✔ | Alias for eni::s256 . |
eni::u256 |
256 | ✘ | Alias for boost::multiprecision::uint256_t . |
eni::u160 |
160 | ✘ | Size of an Ethereum address. |
eni::u128 |
128 | ✘ | Alias for boost::multiprecision::uint128_t . |
eni::u64 |
64 | ✘ | |
eni::UInt |
256 | ✘ | Alias for eni::u256 . |
Operations on ENI Integers¶
See the documentation for boost::multiprecision::number for supported operations.
Suggested Use of ENI Integers¶
This section does not exist yet. (´-ι_-`)
ENI Boolean¶
eni::Bool
is an alias for C++ bool
.
ENI Address¶
eni::Address
is an alias for eni::u160
(20 bytes, size of an Ethereum address).
Convert ENI Types to C++ String¶
eni::to_string
uses boost::lexical_cast internally to
convert ENI types to std::string
.
All ENI integers, eni::Bool
, eni::Address
are supported.
std::string to_string(eni::TypeName);
Usage¶
eni::Int int32max(2147483647);
std::string s = eni::to_string(int32max); // "2147483647"
eni::Bool bTrue(true);
std::string t = eni::to_string(bTrue); // "true"
JSON Types¶
This section does not exist yet. (´-ι_-`)