Menu

namespace eosio

Class List > eosio

Classes

Type Name
struct action
struct action_wrapper
Used to wrap an a particular action to simplify the process of other contracts sending inline actions to "wrapped" action. Example:
struct asset
class binary_extension
struct block_signing_authority_v0
weighted threshold multi-sig authority
class block_timestamp
struct blockchain_parameters
struct const_mem_fun
class contract
class datastream
class datastream< size_t >
struct extended_asset
class extended_symbol
class fixed_bytes
struct ignore
struct ignore_wrapper
struct indexed_by
struct inline_dispatcher
struct inline_dispatcher< void(T::*)(Args...), Name >
class iostream
struct key_weight
class microseconds
class multi_index
struct name
struct onerror
struct overloaded
struct permission_level
struct producer_authority
Maps producer with its signing key.
struct producer_key
struct producer_schedule
class rope
struct signed_int
class singleton
class string
class symbol
class symbol_code
class time_point
class time_point_sec
class transaction
class transaction_header
Contains details about the transaction.
struct unsigned_int
struct variant_action_wrapper

Typedefs

Type Name
typedef std::variant< block_signing_authority_v0 > block_signing_authority
typedef std::tuple< uint16_t, std::vector< char > > extension
typedef std::vector< extension > extensions_type
typedef block_timestamp block_timestamp_type

Variables

Type Name
static constexpr name same_payer
constexpr auto powers_of_base
static iostream cout

Functions

Type Name
T unpack_action_data ()
void require_recipient (name notify_account)
Add the specified account to set of accounts to be notified.
void require_recipient (name notify_account, accounts... remaining_accounts)
void require_auth (name n)
time_point publication_time ()
name current_receiver ()
uint32_t read_action_data (void * msg, uint32_t len)
uint32_t action_data_size ()
void require_auth (const permission_level & level)
bool has_auth (name n)
bool is_account (name n)
void dispatch_inline (name code, name act, std::vector< permission_level > perms, std::tuple< Args... > args)
bool dispatch (uint64_t code, uint64_t act)
bool execute_action (name self, name code, void(T::*)(Args...) func)
bool check_transaction_authorization (const char * trx_data, uint32_t trx_size, const char * pubkeys_data, uint32_t pubkeys_size, const char * perms_data, uint32_t perms_size)
bool check_permission_authorization (name account, name permission, const char * pubkeys_data, uint32_t pubkeys_size, const char * perms_data, uint32_t perms_size, microseconds delay)
bool check_transaction_authorization (const transaction & trx, const std::set< permission_level > & provided_permissions, const std::set< public_key > & provided_keys = std::set< public_key >())
bool check_permission_authorization (name account, name permission, const std::set< public_key > & provided_keys, const std::set< permission_level > & provided_permissions = std::set< permission_level >(), microseconds provided_delay = microseconds{std::numeric_limits< int64_t >::max()})
time_point get_permission_last_used (name account, name permission)
time_point get_account_creation_time (name account)
void set_blockchain_parameters (const eosio::blockchain_parameters & params)
void get_blockchain_parameters (eosio::blockchain_parameters & params)
void get_resource_limits (name account, int64_t & ram_bytes, int64_t & net_weight, int64_t & cpu_weight)
void set_resource_limits (name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight)
std::optional< uint64_t > set_proposed_producers (const std::vector< producer_key > & prods)
std::optional< uint64_t > set_proposed_producers (const std::vector< producer_authority > & prods)
bool is_privileged (name account)
void set_privileged (name account, bool is_priv)
void preactivate_feature (const checksum256 & feature_digest)
std::vector< name > get_active_producers ()
void eosio_exit (int32_t code)
time_point current_time_point ()
block_timestamp current_block_time ()
bool is_feature_activated (const checksum256 & feature_digest)
name get_sender ()
void send_deferred (const uint128_t & sender_id, name payer, const char * serialized_transaction, size_t size, bool replace = false)
action get_action (uint32_t type, uint32_t index)
size_t read_transaction (char * ptr, size_t sz)
int cancel_deferred (const uint128_t & sender_id)
size_t transaction_size ()
int tapos_block_num ()
int tapos_block_prefix ()
uint32_t expiration ()
Gets the expiration of the currently executing transaction.
int get_context_free_data (uint32_t index, char * buff, size_t size)
char * write_decimal (char * begin, char * end, bool dry_run, uint64_t number, uint8_t num_decimal_places, bool negative)
void check (bool pred, const char * msg)
void check (bool pred, const std::string & msg)
void check (bool pred, std::string && msg)
void check (bool pred, const char * msg, size_t n)
void check (bool pred, const std::string & msg, size_t n)
void check (bool pred, uint64_t code)
datastream< Stream > & operator<< (datastream< Stream > & ds, const std::list< T > & l)
datastream< Stream > & operator>> (datastream< Stream > & ds, std::list< T > & l)
datastream< Stream > & operator<< (datastream< Stream > & ds, const std::deque< T > & d)
datastream< Stream > & operator>> (datastream< Stream > & ds, std::deque< T > & d)
datastream< Stream > & operator<< (datastream< Stream > & ds, const std::variant< Ts... > & var)
void deserialize (datastream< Stream > & ds, std::variant< Ts... > & var, int i)
datastream< Stream > & operator>> (datastream< Stream > & ds, std::variant< Ts... > & var)
DataStream & operator<< (DataStream & ds, const std::pair< T1, T2 > & t)
DataStream & operator>> (DataStream & ds, std::pair< T1, T2 > & t)
datastream< Stream > & operator<< (datastream< Stream > & ds, const std::optional< T > & opt)
datastream< Stream > & operator>> (datastream< Stream > & ds, std::optional< T > & opt)
datastream< Stream > & operator<< (datastream< Stream > & ds, const bool & d)
datastream< Stream > & operator>> (datastream< Stream > & ds, bool & d)
Deserialize a bool.
DataStream & operator<< (DataStream & ds, const std::string & v)
DataStream & operator>> (DataStream & ds, std::string & v)
DataStream & operator<< (DataStream & ds, const std::array< T, N > & v)
DataStream & operator>> (DataStream & ds, std::array< T, N > & v)
Deserialize a fixed size std::array.
DataStream & operator>> (DataStream & ds, T)
Deserialize a a pointer.
DataStream & operator<< (DataStream & ds, const T(&) v)
Serialize a fixed size C array of non-primitive and non-pointer type.
DataStream & operator>> (DataStream & ds, T(&) v)
Deserialize a fixed size C array of non-primitive and non-pointer type.
DataStream & operator<< (DataStream & ds, const std::vector< char > & v)
Serialize a vector of char.
DataStream & operator<< (DataStream & ds, const std::vector< T > & v)
Serialize a vector.
DataStream & operator>> (DataStream & ds, std::vector< char > & v)
Deserialize a vector of char.
DataStream & operator>> (DataStream & ds, std::vector< T > & v)
Deserialize a vector.
DataStream & operator<< (DataStream & ds, const std::set< T > & s)
Serialize a set.
DataStream & operator>> (DataStream & ds, std::set< T > & s)
Deserialize a set.
DataStream & operator<< (DataStream & ds, const std::map< K, V > & m)
Serialize a map.
DataStream & operator>> (DataStream & ds, std::map< K, V > & m)
Deserialize a map.
DataStream & operator<< (DataStream & ds, const std::tuple< Args... > & t)
Serialize a tuple.
DataStream & operator>> (DataStream & ds, std::tuple< Args... > & t)
Deserialize a tuple.
DataStream & operator<< (DataStream & ds, const T & v)
Serialize a class.
DataStream & operator>> (DataStream & ds, T & v)
Deserialize a class.
T unpack (const char * buffer, size_t len)
Unpack data inside a fixed size buffer as T.
T unpack (const std::vector< char > & bytes)
Unpack data inside a variable size buffer as T.
size_t pack_size (const T & value)
Get the size of the packed data.
std::vector< char > pack (const T & value)
Get packed data.
DataStream & operator<< (DataStream & ds, const ::eosio::ignore_wrapper< T > & val)
Serialize ignored_wrapper's T value.
DataStream & operator<< (DataStream & ds, const ::eosio::ignore< T > & val)
Serialize an ignored type.
DataStream & operator>> (DataStream & ds, ::eosio::ignore< T > &)
Deserialize an ignored type.
constexpr T pow (uint8_t exponent)
void printhex (const void * ptr, uint32_t size)
void printl (const char * ptr, size_t len)
void print (const char * ptr)
void print (T num)
void print (float num)
void print (double num)
void print (long double num)
void print (T && t)
void print_f (const char * s)
void print_f (const char * s, Arg val, Args... rest)
void print (Arg && a, Args &&... args)
overloaded (Ts...)
bool operator< (const string & lhs, const string & rhs)
bool operator> (const string & lhs, const string & rhs)
bool operator<= (const string & lhs, const string & rhs)
bool operator>= (const string & lhs, const string & rhs)
bool operator== (const string & lhs, const string & rhs)
bool operator!= (const string & lhs, const string & rhs)
string operator+ (const string & lhs, const string & rhs)
DataStream & operator<< (DataStream & ds, const string & str)
DataStream & operator>> (DataStream & ds, string & str)
DataStream & operator<< (DataStream & ds, const eosio::symbol_code sym_code)
DataStream & operator>> (DataStream & ds, eosio::symbol_code & sym_code)
DataStream & operator<< (DataStream & ds, const eosio::symbol sym)
Serialize a symbol.
DataStream & operator>> (DataStream & ds, eosio::symbol & sym)
Deserialize a symbol.
microseconds seconds (int64_t s)
microseconds milliseconds (int64_t s)
microseconds minutes (int64_t m)
microseconds hours (int64_t h)
microseconds days (int64_t d)

Typedefs Documentation

typedef block_signing_authority

using eosio::block_signing_authority = typedef std::variant<block_signing_authority_v0>;

variant of all possible block signing authorities

typedef extension

typedef std::tuple<uint16_t, std::vector<char> > eosio::extension;

typedef extensions_type

typedef std::vector<extension> eosio::extensions_type;

typedef block_timestamp_type

typedef block_timestamp eosio::block_timestamp_type;

Variables Documentation

variable same_payer

constexpr name eosio::same_payer;

variable powers_of_base

constexpr auto eosio::powers_of_base;

variable cout

iostream eosio::cout;

Functions Documentation

function unpack_action_data

template<typename T>
T eosio::unpack_action_data()

Returns:

Unpacked action data casted as T.

Example:

struct dummy_action {
  char a; //1
  unsigned long long b; //8
  int  c; //4

  EOSLIB_SERIALIZE( dummy_action, (a)(b)(c) )
};
dummy_action msg = unpack_action_data<dummy_action>();

function require_recipient (1/2)

void eosio::require_recipient(
    name notify_account
)

Add the specified account to set of accounts to be notified.

Add the specified account to set of accounts to be notified

Parameters:

  • notify_account - name of the account to be verified

function require_recipient (2/2)

template<typename... accounts>
void eosio::require_recipient(
    name notify_account,
    accounts... remaining_accounts
)

All of the listed accounts will be added to the set of accounts to be notified This helper method enables you to add multiple accounts to accounts to be notified list with a single call rather than having to call the similar C API multiple times.

Parameters:

  • notify_account account to be notified
  • remaining_accounts accounts to be notified

Note:

action.code is also considered as part of the set of notified accounts

Example:

require_recipient("Account1"_n, "Account2"_n, "Account3"_n); // throws exception if any of them not in set.

function require_auth (1/2)

void eosio::require_auth(
    name n
)

Verifies that Name exists in the set of provided auths on a action. Fails if not found.

Parameters:

  • name - name of the account to be verified

function publication_time

time_point eosio::publication_time()

Returns the time in microseconds from 1970 of the publication_time

Returns:

the time in microseconds from 1970 of the publication_time

function current_receiver

name eosio::current_receiver()

Get the current receiver of the action

Returns:

the account which specifies the current receiver of the action

function read_action_data

uint32_t eosio::read_action_data(
    void * msg,
    uint32_t len
)

Copy up to length bytes of current action data to the specified location

Parameters:

  • msg - a pointer where up to length bytes of the current action data will be copied
  • len - len of the current action data to be copied, 0 to report required size

Returns:

the number of bytes copied to msg, or number of bytes that can be copied if len==0 passed

Precondition:

msg is a valid pointer to a range of memory at least len bytes long

Post

msg is filled with packed action data

function action_data_size

uint32_t eosio::action_data_size()

Get the length of the current action's data field. This method is useful for dynamically sized actions

Returns:

the length of the current action's data field

function require_auth (2/2)

void eosio::require_auth(
    const permission_level & level
)

Require the specified authorization for this action. If this action doesn't contain the specified auth, it will fail.

Parameters:

  • level - Authorization to be required

function has_auth

bool eosio::has_auth(
    name n
)

Verifies that n has auth.

Parameters:

  • n - name of the account to be verified

function is_account

bool eosio::is_account(
    name n
)

Verifies that n is an existing account.

Parameters:

  • n - name of the account to check

function dispatch_inline

template<typename... Args>
void eosio::dispatch_inline(
    name code,
    name act,
    std::vector< permission_level > perms,
    std::tuple< Args... > args
)

function dispatch

template<typename Contract, typename FirstAction, typename SecondAction, typename... Actions>
bool eosio::dispatch(
    uint64_t code,
    uint64_t act
)

This method will dynamically dispatch an incoming set of actions to

static Contract::on( ActionType )

For this to work the Actions must be derived from eosio::contract

function execute_action

template<typename T, typename... Args>
bool eosio::execute_action(
    name self,
    name code,
    void(T::*)(Args...) func
)

Unpack the received action and execute the correponding action handler

Template parameters:

  • T - The contract class that has the correponding action handler, this contract should be derived from eosio::contract
  • Q - The namespace of the action handler function
  • Args - The arguments that the action handler accepts, i.e. members of the action

Parameters:

  • obj - The contract object that has the correponding action handler
  • func - The action handler

Returns:

true

function check_transaction_authorization

bool eosio::check_transaction_authorization(
    const char * trx_data,
    uint32_t trx_size,
    const char * pubkeys_data,
    uint32_t pubkeys_size,
    const char * perms_data,
    uint32_t perms_size
)

Checks if a transaction is authorized by a provided set of keys and permissions

Parameters:

  • trx_data - pointer to the start of the serialized transaction
  • trx_size - size (in bytes) of the serialized transaction
  • pubkeys_data - pointer to the start of the serialized vector of provided public keys
  • pubkeys_size - size (in bytes) of serialized vector of provided public keys (can be 0 if no public keys are to be provided)
  • perms_data - pointer to the start of the serialized vector of provided permissions (empty permission name acts as wildcard)
  • perms_size - size (in bytes) of the serialized vector of provided permissions

Returns:

1 if the transaction is authorized, 0 otherwise

function check_permission_authorization

bool eosio::check_permission_authorization(
    name account,
    name permission,
    const char * pubkeys_data,
    uint32_t pubkeys_size,
    const char * perms_data,
    uint32_t perms_size,
    microseconds delay
)

Checks if a permission is authorized by a provided delay and a provided set of keys and permissions

Parameters:

  • account - the account owner of the permission
  • permission - the name of the permission to check for authorization
  • pubkeys_data - pointer to the start of the serialized vector of provided public keys
  • pubkeys_size - size (in bytes) of serialized vector of provided public keys (can be 0 if no public keys are to be provided)
  • perms_data - pointer to the start of the serialized vector of provided permissions (empty permission name acts as wildcard)
  • perms_size - size (in bytes) of the serialized vector of provided permissions
  • delay - the provided delay in microseconds (cannot exceed INT64_MAX)

Returns:

1 if the permission is authorized, 0 otherwise

function check_transaction_authorization

bool eosio::check_transaction_authorization(
    const transaction & trx,
    const std::set< permission_level > & provided_permissions,
    const std::set< public_key > & provided_keys = std::set< public_key >()
)

Checks if a transaction is authorized by a provided set of keys and permissions

Parameters:

  • trx - the transaction for which to check authorizations
  • provided_permissions - the set of permissions which have authorized the transaction (empty permission name acts as wildcard)
  • provided_keys - the set of public keys which have authorized the transaction

Returns:

whether the transaction was authorized by provided keys and permissions

function check_permission_authorization

bool eosio::check_permission_authorization(
    name account,
    name permission,
    const std::set< public_key > & provided_keys,
    const std::set< permission_level > & provided_permissions = std::set< permission_level >(),
    microseconds provided_delay = microseconds{std::numeric_limits< int64_t >::max()}
)

Checks if a permission is authorized by a provided delay and a provided set of keys and permissions

Parameters:

  • account - the account owner of the permission
  • permission - the permission name to check for authorization
  • provided_keys - the set of public keys which have authorized the transaction
  • provided_permissions - the set of permissions which have authorized the transaction (empty permission name acts as wildcard)
  • provided_delay_us - the provided delay in microseconds (cannot exceed INT64_MAX)

Returns:

whether the permission was authorized by provided delay, keys, and permissions

function get_permission_last_used

time_point eosio::get_permission_last_used(
    name account,
    name permission
)

Returns the last used time of a permission

Parameters:

  • account - the account owner of the permission
  • permission - the name of the permission

Returns:

the last used time (in microseconds since Unix epoch) of the permission

function get_account_creation_time

time_point eosio::get_account_creation_time(
    name account
)

Returns the creation time of an account

Parameters:

  • account - the account

Returns:

the creation time (in microseconds since Unix epoch) of the account

function set_blockchain_parameters

void eosio::set_blockchain_parameters(
    const eosio::blockchain_parameters & params
)

Set the blockchain parameters

Parameters:

  • params - New blockchain parameters to set

function get_blockchain_parameters

void eosio::get_blockchain_parameters(
    eosio::blockchain_parameters & params
)

Retrieve the blolckchain parameters

Parameters:

  • params - It will be replaced with the retrieved blockchain params

function get_resource_limits

void eosio::get_resource_limits(
    name account,
    int64_t & ram_bytes,
    int64_t & net_weight,
    int64_t & cpu_weight
)

Get the resource limits of an account

Parameters:

  • account - name of the account whose resource limit to get
  • ram_bytes - output to hold retrieved ram limit in absolute bytes
  • net_weight - output to hold net limit
  • cpu_weight - output to hold cpu limit

function set_resource_limits

void eosio::set_resource_limits(
    name account,
    int64_t ram_bytes,
    int64_t net_weight,
    int64_t cpu_weight
)

Set the resource limits of an account

Parameters:

  • account - name of the account whose resource limit to be set
  • ram_bytes - ram limit in absolute bytes
  • net_weight - fractionally proportionate net limit of available resources based on (weight / total_weight_of_all_accounts)
  • cpu_weight - fractionally proportionate cpu limit of available resources based on (weight / total_weight_of_all_accounts)

function set_proposed_producers (1/2)

std::optional<uint64_t> eosio::set_proposed_producers(
    const std::vector< producer_key > & prods
)

Proposes a schedule change using the legacy producer key format

Note:

Once the block that contains the proposal becomes irreversible, the schedule is promoted to "pending" automatically. Once the block that promotes the schedule is irreversible, the schedule will become "active"

Parameters:

  • producers - vector of producer keys

Returns:

an optional value of the version of the new proposed schedule if successful

function set_proposed_producers (2/2)

std::optional<uint64_t> eosio::set_proposed_producers(
    const std::vector< producer_authority > & prods
)

Proposes a schedule change using the more flexible key format

Note:

Once the block that contains the proposal becomes irreversible, the schedule is promoted to "pending" automatically. Once the block that promotes the schedule is irreversible, the schedule will become "active"

Parameters:

  • producers - vector of producer authorities

Returns:

an optional value of the version of the new proposed schedule if successful

function is_privileged

bool eosio::is_privileged(
    name account
)

Check if an account is privileged

Parameters:

  • account - name of the account to be checked

Returns:

true if the account is privileged

Returns:

false if the account is not privileged

function set_privileged

void eosio::set_privileged(
    name account,
    bool is_priv
)

Set the privileged status of an account

Parameters:

  • account - name of the account whose privileged account to be set
  • is_priv - privileged status

function preactivate_feature

void eosio::preactivate_feature(
    const checksum256 & feature_digest
)

Pre-activate protocol feature

Parameters:

  • feature_digest - digest of the protocol feature to pre-activate

function get_active_producers

std::vector<name> eosio::get_active_producers()

Returns back the list of active producer names.

function eosio_exit

void eosio::eosio_exit(
    int32_t code
)

This method will abort execution of wasm without failing the contract. This is used to bypass all cleanup / destructors that would normally be called.

Parameters:

  • code - the exit code Example:
eosio_exit(0);
eosio_exit(1);
eosio_exit(2);
eosio_exit(3);

function current_time_point

time_point eosio::current_time_point()

Returns the time in microseconds from 1970 of the current block as a time_point

Returns:

time in microseconds from 1970 of the current block as a time_point

function current_block_time

block_timestamp eosio::current_block_time()

Returns the time in microseconds from 1970 of the current block as a block_timestamp

Returns:

time in microseconds from 1970 of the current block as a block_timestamp

function is_feature_activated

bool eosio::is_feature_activated(
    const checksum256 & feature_digest
)

Check if specified protocol feature has been activated

Parameters:

  • feature_digest - digest of the protocol feature

Returns:

true if the specified protocol feature has been activated, false otherwise

function get_sender

name eosio::get_sender()

Return name of account that sent current inline action

Returns:

name of account that sent the current inline action (empty name if not called from inline action)

function send_deferred

void eosio::send_deferred(
    const uint128_t & sender_id,
    name payer,
    const char * serialized_transaction,
    size_t size,
    bool replace = false
)

Send a deferred transaction

Parameters:

  • sender_id - Account name of the sender of this deferred transaction
  • payer - Account name responsible for paying the RAM for this deferred transaction
  • serialized_transaction - The packed transaction to be deferred
  • size - The size of the packed transaction, required for persistence.
  • replace - If true, will replace an existing transaction.

function get_action

action eosio::get_action(
    uint32_t type,
    uint32_t index
)

Retrieve the indicated action from the active transaction.

Parameters:

  • type - 0 for context free action, 1 for action
  • index - the index of the requested action

Returns:

the indicated action

function read_transaction

size_t eosio::read_transaction(
    char * ptr,
    size_t sz
)

Access a copy of the currently executing transaction.

Returns:

the currently executing transaction

function cancel_deferred

int eosio::cancel_deferred(
    const uint128_t & sender_id
)

Cancels a deferred transaction.

Parameters:

  • sender_id - The id of the sender

Precondition:

The deferred transaction ID exists.

Precondition:

The deferred transaction ID has not yet been published.

Post

Deferred transaction canceled.

Returns:

1 if transaction was canceled, 0 if transaction was not found

Example:

id = 0xffffffffffffffff
cancel_deferred( id );

function transaction_size

size_t eosio::transaction_size()

Gets the size of the currently executing transaction.

Returns:

size of the currently executing transaction

function tapos_block_num

int eosio::tapos_block_num()

Gets the block number used for TAPOS on the currently executing transaction.

Returns:

block number used for TAPOS on the currently executing transaction Example:

int tbn = tapos_block_num();

function tapos_block_prefix

int eosio::tapos_block_prefix()

Gets the block prefix used for TAPOS on the currently executing transaction.

Returns:

block prefix used for TAPOS on the currently executing transaction Example:

int tbp = tapos_block_prefix();

function expiration

uint32_t eosio::expiration()

Gets the expiration of the currently executing transaction.

Gets the expiration of the currently executing transaction.

Returns:

expiration of the currently executing transaction in seconds since Unix epoch

function get_context_free_data

int eosio::get_context_free_data(
    uint32_t index,
    char * buff,
    size_t size
)

Retrieve the signed_transaction.context_free_data[index].

Parameters:

  • index - the index of the context_free_data entry to retrieve
  • buff - output buff of the context_free_data entry
  • size - amount of context_free_data[index] to retrieve into buff, 0 to report required size

Returns:

size copied, or context_free_data[index].size() if 0 passed for size, or -1 if index not valid

function write_decimal

char* eosio::write_decimal(
    char * begin,
    char * end,
    bool dry_run,
    uint64_t number,
    uint8_t num_decimal_places,
    bool negative
)

function check (1/6)

void eosio::check(
    bool pred,
    const char * msg
)

Assert if the predicate fails and use the supplied message. Example:

eosio::check(a == b, "a does not equal b");

function check (2/6)

void eosio::check(
    bool pred,
    const std::string & msg
)

Assert if the predicate fails and use the supplied message. Example:

eosio::check(a == b, "a does not equal b");

function check (3/6)

void eosio::check(
    bool pred,
    std::string && msg
)

Assert if the predicate fails and use the supplied message. Example:

eosio::check(a == b, "a does not equal b");

function check (4/6)

void eosio::check(
    bool pred,
    const char * msg,
    size_t n
)

Assert if the predicate fails and use a subset of the supplied message. Example:

const char* msg = "a does not equal b b does not equal a";
eosio::check(a == b, "a does not equal b", 18);

function check (5/6)

void eosio::check(
    bool pred,
    const std::string & msg,
    size_t n
)

Assert if the predicate fails and use a subset of the supplied message. Example:

std::string msg = "a does not equal b b does not equal a";
eosio::check(a == b, msg, 18);

function check (6/6)

void eosio::check(
    bool pred,
    uint64_t code
)

Assert if the predicate fails and use the supplied error code. Example:

eosio::check(a == b, 13);

function operator<< (1/20)

template<typename Stream, typename T>
datastream<Stream>& eosio::operator<<(
    datastream< Stream > & ds,
    const std::list< T > & l
)

Serialize an std::list into a stream

Parameters:

  • ds - The stream to write
  • opt - The value to serialize

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator>> (1/20)

template<typename Stream, typename T>
datastream<Stream>& eosio::operator>>(
    datastream< Stream > & ds,
    std::list< T > & l
)

Deserialize an std::list from a stream

Parameters:

  • ds - The stream to read
  • opt - The destination for deserialized value

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator<< (2/20)

template<typename Stream, typename T>
datastream<Stream>& eosio::operator<<(
    datastream< Stream > & ds,
    const std::deque< T > & d
)

Serialize an std::deque into a stream

Parameters:

  • ds - The stream to write
  • opt - The value to serialize

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator>> (2/20)

template<typename Stream, typename T>
datastream<Stream>& eosio::operator>>(
    datastream< Stream > & ds,
    std::deque< T > & d
)

Deserialize an std::deque from a stream

Parameters:

  • ds - The stream to read
  • opt - The destination for deserialized value

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator<< (3/20)

template<typename Stream, typename... Ts>
datastream<Stream>& eosio::operator<<(
    datastream< Stream > & ds,
    const std::variant< Ts... > & var
)

Serialize an std::variant into a stream

Parameters:

  • ds - The stream to write
  • opt - The value to serialize

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function deserialize

template<int I, typename Stream, typename... Ts>
void eosio::deserialize(
    datastream< Stream > & ds,
    std::variant< Ts... > & var,
    int i
)

function operator>> (3/20)

template<typename Stream, typename... Ts>
datastream<Stream>& eosio::operator>>(
    datastream< Stream > & ds,
    std::variant< Ts... > & var
)

Deserialize an std::variant from a stream

Parameters:

  • ds - The stream to read
  • opt - The destination for deserialized value

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator<< (4/20)

template<typename DataStream, typename T1, typename T2>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::pair< T1, T2 > & t
)

Serialize an std::pair

Parameters:

  • ds - The stream to write
  • t - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • Args - Type of the objects contained in the tuple

Returns:

DataStream& - Reference to the datastream

function operator>> (4/20)

template<typename DataStream, typename T1, typename T2>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::pair< T1, T2 > & t
)

Deserialize an std::pair

Parameters:

  • ds - The stream to read
  • t - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • Args - Type of the objects contained in the tuple

Returns:

DataStream& - Reference to the datastream

function operator<< (5/20)

template<typename Stream, typename T>
datastream<Stream>& eosio::operator<<(
    datastream< Stream > & ds,
    const std::optional< T > & opt
)

Serialize an optional into a stream

Parameters:

  • ds - The stream to write
  • opt - The value to serialize

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator>> (5/20)

template<typename Stream, typename T>
datastream<Stream>& eosio::operator>>(
    datastream< Stream > & ds,
    std::optional< T > & opt
)

Deserialize an optional from a stream

Parameters:

  • ds - The stream to read
  • opt - The destination for deserialized value

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator<< (6/20)

template<typename Stream>
datastream<Stream>& eosio::operator<<(
    datastream< Stream > & ds,
    const bool & d
)

Serialize a bool into a stream

Parameters:

  • ds - The stream to read
  • d - The value to serialize

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator>> (6/20)

template<typename Stream>
datastream<Stream>& eosio::operator>>(
    datastream< Stream > & ds,
    bool & d
)

Deserialize a bool.

Deserialize a bool from a stream

Parameters:

  • ds - The stream to read
  • d - The destination for deserialized value

Template parameters:

  • Stream - Type of datastream buffer

Returns:

datastream& - Reference to the datastream

function operator<< (7/20)

template<typename DataStream>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::string & v
)

Serialize a string into a stream

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

function operator>> (7/20)

template<typename DataStream>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::string & v
)

Deserialize a string from a stream

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

function operator<< (8/20)

template<typename DataStream, typename T, std::size_t N>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::array< T, N > & v
)

Serialize a fixed size std::array

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the object contained in the array
  • N - Size of the array

Returns:

DataStream& - Reference to the datastream

function operator>> (8/20)

template<typename DataStream, typename T, std::size_t N>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::array< T, N > & v
)

Deserialize a fixed size std::array.

Deserialize a fixed size std::array

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the object contained in the array
  • N - Size of the array

Returns:

DataStream& - Reference to the datastream

function operator>> (9/20)

template<typename DataStream, typename T, std::enable_if_t< _datastream_detail::is_pointer< T >()> *>
DataStream& eosio::operator>>(
    DataStream & ds,
    T 
)

Deserialize a a pointer.

Pointer should not be serialized, so this function will always throws an error

Parameters:

  • ds - The stream to read

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the pointer

Returns:

DataStream& - Reference to the datastream

Post

Throw an exception if it is a pointer

function operator<< (9/20)

template<typename DataStream, typename T, std::size_t N, std::enable_if_t<!_datastream_detail::is_primitive< T >() &&!_datastream_detail::is_pointer< T >()> *>
DataStream & eosio::operator<<(
    DataStream & ds,
    const T(&) v
)

Serialize a fixed size C array of non-primitive and non-pointer type.

Serialize a fixed size C array of primitive type. Serialize a fixed size C array of non-primitive and non-pointer type

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the pointer

Returns:

DataStream& - Reference to the datastream

Serialize a fixed size C array of primitive type

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the pointer

Returns:

DataStream& - Reference to the datastream

function operator>> (10/20)

template<typename DataStream, typename T, std::size_t N, std::enable_if_t<!_datastream_detail::is_primitive< T >() &&!_datastream_detail::is_pointer< T >()> *>
DataStream & eosio::operator>>(
    DataStream & ds,
    T(&) v
)

Deserialize a fixed size C array of non-primitive and non-pointer type.

Deserialize a fixed size C array of primitive type. Deserialize a fixed size C array of non-primitive and non-pointer type

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • T - Type of the object contained in the array
  • N - Size of the array
  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

Deserialize a fixed size C array of primitive type

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • T - Type of the object contained in the array
  • N - Size of the array
  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

function operator<< (10/20)

template<typename DataStream>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::vector< char > & v
)

Serialize a vector of char.

Serialize a vector of char

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

function operator<< (11/20)

template<typename DataStream, typename T>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::vector< T > & v
)

Serialize a vector.

Serialize a vector

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the object contained in the vector

Returns:

DataStream& - Reference to the datastream

function operator>> (11/20)

template<typename DataStream>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::vector< char > & v
)

Deserialize a vector of char.

Deserialize a vector of char

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

function operator>> (12/20)

template<typename DataStream, typename T>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::vector< T > & v
)

Deserialize a vector.

Deserialize a vector

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the object contained in the vector

Returns:

DataStream& - Reference to the datastream

function operator<< (12/20)

template<typename DataStream, typename T>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::set< T > & s
)

Serialize a set.

Serialize a set

Parameters:

  • ds - The stream to write
  • s - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the object contained in the set

Returns:

DataStream& - Reference to the datastream

function operator>> (13/20)

template<typename DataStream, typename T>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::set< T > & s
)

Deserialize a set.

Deserialize a set

Parameters:

  • ds - The stream to read
  • s - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the object contained in the set

Returns:

DataStream& - Reference to the datastream

function operator<< (13/20)

template<typename DataStream, typename K, typename V>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::map< K, V > & m
)

Serialize a map.

Serialize a map

Parameters:

  • ds - The stream to write
  • m - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • K - Type of the key contained in the map
  • V - Type of the value contained in the map

Returns:

DataStream& - Reference to the datastream

function operator>> (14/20)

template<typename DataStream, typename K, typename V>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::map< K, V > & m
)

Deserialize a map.

Deserialize a map

Parameters:

  • ds - The stream to read
  • m - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • K - Type of the key contained in the map
  • V - Type of the value contained in the map

Returns:

DataStream& - Reference to the datastream

function operator<< (14/20)

template<typename DataStream, typename... Args>
DataStream& eosio::operator<<(
    DataStream & ds,
    const std::tuple< Args... > & t
)

Serialize a tuple.

Serialize a tuple

Parameters:

  • ds - The stream to write
  • t - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • Args - Type of the objects contained in the tuple

Returns:

DataStream& - Reference to the datastream

function operator>> (15/20)

template<typename DataStream, typename... Args>
DataStream& eosio::operator>>(
    DataStream & ds,
    std::tuple< Args... > & t
)

Deserialize a tuple.

Deserialize a tuple

Parameters:

  • ds - The stream to read
  • t - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • Args - Type of the objects contained in the tuple

Returns:

DataStream& - Reference to the datastream

function operator<< (15/20)

template<typename DataStream, typename T, std::enable_if_t< std::is_class< T >::value > *>
DataStream & eosio::operator<<(
    DataStream & ds,
    const T & v
)

Serialize a class.

Serialize a primitive type. Serialize a class

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • T - Type of class

Returns:

DataStream& - Reference to the datastream

Serialize a primitive type

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the primitive type

Returns:

DataStream& - Reference to the datastream

function operator>> (16/20)

template<typename DataStream, typename T, std::enable_if_t< std::is_class< T >::value > *>
DataStream & eosio::operator>>(
    DataStream & ds,
    T & v
)

Deserialize a class.

Deserialize a primitive type. Deserialize a class

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • T - Type of class

Returns:

DataStream& - Reference to the datastream

Deserialize a primitive type

Parameters:

  • ds - The stream to read
  • v - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream
  • T - Type of the primitive type

Returns:

DataStream& - Reference to the datastream

function unpack (1/2)

template<typename T>
T eosio::unpack(
    const char * buffer,
    size_t len
)

Unpack data inside a fixed size buffer as T.

Unpack data inside a fixed size buffer as T

Template parameters:

  • T - Type of the unpacked data

Parameters:

  • buffer - Pointer to the buffer
  • len - Length of the buffer

Returns:

T - The unpacked data

function unpack (2/2)

template<typename T>
T eosio::unpack(
    const std::vector< char > & bytes
)

Unpack data inside a variable size buffer as T.

Unpack data inside a variable size buffer as T

Template parameters:

  • T - Type of the unpacked data

Parameters:

  • bytes - Buffer

Returns:

T - The unpacked data

function pack_size

template<typename T>
size_t eosio::pack_size(
    const T & value
)

Get the size of the packed data.

Get the size of the packed data

Template parameters:

  • T - Type of the data to be packed

Parameters:

  • value - Data to be packed

Returns:

size_t - Size of the packed data

function pack

template<typename T>
std::vector<char> eosio::pack(
    const T & value
)

Get packed data.

Get packed data

Template parameters:

  • T - Type of the data to be packed

Parameters:

  • value - Data to be packed

Returns:

bytes - The packed data

function operator<< (16/20)

template<typename DataStream, typename T>
DataStream& eosio::operator<<(
    DataStream & ds,
    const ::eosio::ignore_wrapper< T > & val
)

Serialize ignored_wrapper's T value.

Serialize an ignored_wrapper type into a stream

Parameters:

  • ds - The stream to write
  • val - The value to serialize

Template parameters:

  • DataStream - Type of datastream buffer

Returns:

DataStream& - Reference to the datastream

function operator<< (17/20)

template<typename DataStream, typename T>
DataStream& eosio::operator<<(
    DataStream & ds,
    const ::eosio::ignore< T > & val
)

Serialize an ignored type.

Serialize an ignored type into a stream

Parameters:

  • ds - The stream to write
  • ignore - The value to serialize

Template parameters:

  • DataStream - Type of datastream buffer

Returns:

DataStream& - Reference to the datastream

function operator>> (17/20)

template<typename DataStream, typename T>
DataStream& eosio::operator>>(
    DataStream & ds,
    ::eosio::ignore< T > & 
)

Deserialize an ignored type.

Deserialize an ignored type from a stream

Parameters:

  • ds - The stream to read
  • ignored - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream buffer

Returns:

DataStream& - Reference to the datastream

function pow

template<uint8_t Base, typename T>
constexpr T eosio::pow(
    uint8_t exponent
)

Returns:

Base^exponent

function printhex

void eosio::printhex(
    const void * ptr,
    uint32_t size
)

Prints a block of bytes in hexadecimal

Parameters:

  • ptr - pointer to bytes of interest
  • size - number of bytes to print

function printl

void eosio::printl(
    const char * ptr,
    size_t len
)

Prints string to a given length

Parameters:

  • ptr - a string
  • len - number of chars to print

function print (1/7)

void eosio::print(
    const char * ptr
)

Prints string

Parameters:

  • ptr - a null terminated string

function print (2/7)

template<typename T, std::enable_if_t< std::is_integral< std::decay_t< T >>::value &&std::is_signed< std::decay_t< T >>::value, int >>
void eosio::print(
    T num
)

Prints 8-128 bit signed integer

Parameters:

  • num to be printed

Prints 8-128 bit unsigned integer

Parameters:

  • num to be printed

function print (3/7)

void eosio::print(
    float num
)

Prints single-precision floating point number (i.e. float)

Parameters:

  • num to be printed

function print (4/7)

void eosio::print(
    double num
)

Prints double-precision floating point number (i.e. double)

Parameters:

  • num to be printed

function print (5/7)

void eosio::print(
    long double num
)

Prints quadruple-precision floating point number (i.e. long double)

Parameters:

  • num to be printed

function print (6/7)

template<typename T, std::enable_if_t<!std::is_integral< std::decay_t< T >>::value, int >>
void eosio::print(
    T && t
)

Prints class object

Parameters:

  • t to be printed

Precondition:

T must implements print() function

function print_f (1/2)

void eosio::print_f(
    const char * s
)

Prints null terminated string

Parameters:

  • s null terminated string to be printed

function print_f (2/2)

template<typename Arg, typename... Args>
void eosio::print_f(
    const char * s,
    Arg val,
    Args... rest
)

Prints formatted string. It behaves similar to C printf/

Template parameters:

  • Arg - Type of the value used to replace the format specifier
  • Args - Type of the value used to replace the format specifier

Parameters:

  • s - Null terminated string with to be printed (it can contains format specifier)
  • val - The value used to replace the format specifier
  • rest - The values used to replace the format specifier

Example:

print_f("Number of apples: %", 10);

function print (7/7)

template<typename Arg, typename... Args>
void eosio::print(
    Arg && a,
    Args &&... args
)

Print out value / list of values

Template parameters:

  • Arg - Type of the value used to replace the format specifier
  • Args - Type of the value used to replace the format specifier

Parameters:

  • a - The value to be printed
  • args - The other values to be printed

Example:

const char *s = "Hello World!";
uint64_t unsigned_64_bit_int = 1e+18;
uint128_t unsigned_128_bit_int (87654323456);
uint64_t string_as_unsigned_64_bit = "abcde"_n;
print(s , unsigned_64_bit_int, unsigned_128_bit_int, string_as_unsigned_64_bit);
// Ouput: Hello World!100000000000000000087654323456abcde

function overloaded (2/2)

template<class... Ts>
eosio::overloaded(
    Ts... 
)

function operator<

bool eosio::operator<(
    const string & lhs,
    const string & rhs
)

function operator>

bool eosio::operator>(
    const string & lhs,
    const string & rhs
)

function operator<=

bool eosio::operator<=(
    const string & lhs,
    const string & rhs
)

function operator>=

bool eosio::operator>=(
    const string & lhs,
    const string & rhs
)

function operator==

bool eosio::operator==(
    const string & lhs,
    const string & rhs
)

function operator!=

bool eosio::operator!=(
    const string & lhs,
    const string & rhs
)

function operator+

string eosio::operator+(
    const string & lhs,
    const string & rhs
)

function operator<< (18/20)

template<typename DataStream>
DataStream& eosio::operator<<(
    DataStream & ds,
    const string & str
)

function operator>> (18/20)

template<typename DataStream>
DataStream& eosio::operator>>(
    DataStream & ds,
    string & str
)

function operator<< (19/20)

template<typename DataStream>
DataStream& eosio::operator<<(
    DataStream & ds,
    const eosio::symbol_code sym_code
)

Serialize a symbol_code into a stream

Parameters:

  • ds - The stream to write
  • sym - The value to serialize

Template parameters:

  • DataStream - Type of datastream buffer

Returns:

DataStream& - Reference to the datastream

function operator>> (19/20)

template<typename DataStream>
DataStream& eosio::operator>>(
    DataStream & ds,
    eosio::symbol_code & sym_code
)

Deserialize a symbol_code from a stream

Parameters:

  • ds - The stream to read
  • symbol - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream buffer

Returns:

DataStream& - Reference to the datastream

function operator<< (20/20)

template<typename DataStream>
DataStream& eosio::operator<<(
    DataStream & ds,
    const eosio::symbol sym
)

Serialize a symbol.

Serialize a symbol into a stream

Parameters:

  • ds - The stream to write
  • sym - The value to serialize

Template parameters:

  • DataStream - Type of datastream buffer

Returns:

DataStream& - Reference to the datastream

function operator>> (20/20)

template<typename DataStream>
DataStream& eosio::operator>>(
    DataStream & ds,
    eosio::symbol & sym
)

Deserialize a symbol.

Deserialize a symbol from a stream

Parameters:

  • ds - The stream to read
  • symbol - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream buffer

Returns:

DataStream& - Reference to the datastream

function seconds

microseconds eosio::seconds(
    int64_t s
)

function milliseconds

microseconds eosio::milliseconds(
    int64_t s
)

function minutes

microseconds eosio::minutes(
    int64_t m
)

function hours

microseconds eosio::hours(
    int64_t h
)

function days

microseconds eosio::days(
    int64_t d
)

The documentation for this class was generated from the following file: libraries/eosiolib/contracts/eosio/action.hpp