EVMC
evmc Namespace Reference

EVMC C++ API - wrappers and bindings for C++. More...

Classes

struct  address
 The big-endian 160-bit hash suitable for keeping an Ethereum address. More...
 
struct  bytes32
 The fixed size array of 32 bytes for storing 256-bit EVM values. More...
 
class  result
 The EVM code execution result. More...
 
class  HostInterface
 The EVMC Host interface. More...
 
class  HostContext
 Wrapper around EVMC host context / host interface. More...
 
class  Host
 Abstract class to be used by Host implementations. More...
 
class  VM
 The VM instance. More...
 
struct  hex_error
 Hex decoding exception. More...
 
struct  storage_value
 Extended value (by dirty flag) for account storage. More...
 
struct  MockedAccount
 Mocked account. More...
 
class  MockedHost
 Mocked EVMC Host implementation. More...
 

Typedefs

using uint256be = bytes32
 The alias for evmc::bytes32 to represent a big-endian 256-bit integer.
 
using bytes = std::basic_string< uint8_t >
 String of uint8_t chars. More...
 
using bytes_view = std::basic_string_view< uint8_t >
 String view of uint8_t chars.
 

Enumerations

enum class  hex_errc { invalid_hex_digit = 1 , incomplete_hex_byte_pair = 2 }
 Hex decoding error codes. More...
 

Functions

constexpr uint64_t load64be (const uint8_t *data) noexcept
 Loads 64 bits / 8 bytes of data from the given data array in big-endian order.
 
constexpr uint64_t load64le (const uint8_t *data) noexcept
 Loads 64 bits / 8 bytes of data from the given data array in little-endian order.
 
constexpr uint32_t load32be (const uint8_t *data) noexcept
 Loads 32 bits / 4 bytes of data from the given data array in big-endian order.
 
constexpr uint32_t load32le (const uint8_t *data) noexcept
 Loads 32 bits / 4 bytes of data from the given data array in little-endian order.
 
constexpr bool operator== (const address &a, const address &b) noexcept
 The "equal to" comparison operator for the evmc::address type.
 
constexpr bool operator!= (const address &a, const address &b) noexcept
 The "not equal to" comparison operator for the evmc::address type.
 
constexpr bool operator< (const address &a, const address &b) noexcept
 The "less than" comparison operator for the evmc::address type.
 
constexpr bool operator> (const address &a, const address &b) noexcept
 The "greater than" comparison operator for the evmc::address type.
 
constexpr bool operator<= (const address &a, const address &b) noexcept
 The "less than or equal to" comparison operator for the evmc::address type.
 
constexpr bool operator>= (const address &a, const address &b) noexcept
 The "greater than or equal to" comparison operator for the evmc::address type.
 
constexpr bool operator== (const bytes32 &a, const bytes32 &b) noexcept
 The "equal to" comparison operator for the evmc::bytes32 type.
 
constexpr bool operator!= (const bytes32 &a, const bytes32 &b) noexcept
 The "not equal to" comparison operator for the evmc::bytes32 type.
 
constexpr bool operator< (const bytes32 &a, const bytes32 &b) noexcept
 The "less than" comparison operator for the evmc::bytes32 type.
 
constexpr bool operator> (const bytes32 &a, const bytes32 &b) noexcept
 The "greater than" comparison operator for the evmc::bytes32 type.
 
constexpr bool operator<= (const bytes32 &a, const bytes32 &b) noexcept
 The "less than or equal to" comparison operator for the evmc::bytes32 type.
 
constexpr bool operator>= (const bytes32 &a, const bytes32 &b) noexcept
 The "greater than or equal to" comparison operator for the evmc::bytes32 type.
 
constexpr bool is_zero (const address &a) noexcept
 Checks if the given address is the zero address.
 
constexpr bool is_zero (const bytes32 &a) noexcept
 Checks if the given bytes32 object has all zero bytes.
 
const char * to_string (evmc_status_code status_code) noexcept
 Returns text representation of the evmc_status_code. More...
 
const char * to_string (evmc_revision rev) noexcept
 Returns the name of the evmc_revision. More...
 
const std::error_category & hex_category () noexcept
 Obtains a reference to the static error category object for hex errors.
 
std::error_code make_error_code (hex_errc errc) noexcept
 Creates error_code object out of a hex error code value.
 
std::string hex (uint8_t b) noexcept
 Encode a byte to a hex string.
 
std::error_code validate_hex (std::string_view hex) noexcept
 Validates hex encoded string.
 
bytes from_hex (std::string_view hex)
 Decodes hex encoded string to bytes. More...
 
std::string hex (bytes_view bs)
 Encodes bytes as hex string.
 

Variables

constexpr auto make_result = evmc_make_result
 Alias for evmc_make_result().
 

Detailed Description

EVMC C++ API - wrappers and bindings for C++.

Typedef Documentation

◆ bytes

typedef std::basic_string< uint8_t > evmc::bytes

String of uint8_t chars.

The string of bytes.

Definition at line 15 of file hex.hpp.

Enumeration Type Documentation

◆ hex_errc

enum evmc::hex_errc
strong

Hex decoding error codes.

Enumerator
invalid_hex_digit 

Invalid hex digit encountered during decoding.

incomplete_hex_byte_pair 

Input contains incomplete hex byte (length is odd).

Definition at line 21 of file hex.hpp.

22 {
25 
28 };
@ invalid_hex_digit
Invalid hex digit encountered during decoding.
@ incomplete_hex_byte_pair
Input contains incomplete hex byte (length is odd).

Function Documentation

◆ from_hex()

bytes evmc::from_hex ( std::string_view  hex)

Decodes hex encoded string to bytes.

Throws hex_error with the appropriate error code.

◆ to_string() [1/2]

const char* evmc::to_string ( evmc_revision  rev)
inlinenoexcept

Returns the name of the evmc_revision.

Definition at line 349 of file evmc.hpp.

350 {
351  return evmc_revision_to_string(rev);
352 }
static const char * evmc_revision_to_string(enum evmc_revision rev)
Returns the name of the evmc_revision.
Definition: helpers.h:264

◆ to_string() [2/2]

const char* evmc::to_string ( evmc_status_code  status_code)
inlinenoexcept

Returns text representation of the evmc_status_code.

Definition at line 343 of file evmc.hpp.

344 {
345  return evmc_status_code_to_string(status_code);
346 }
static const char * evmc_status_code_to_string(enum evmc_status_code status_code)
Returns text representation of the evmc_status_code.
Definition: helpers.h:213