Skip to main content

libraries/native/intrinsics.cpp

Namespaces

Name
eosio::native

Functions

Name
voidget_resource_limits(capi_name account, int64_t ram_bytes, int64_t net_weight, int64_t * cpu_weight)
voidset_resource_limits(capi_name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight)
int64_tset_proposed_producers(char * producer_data, uint32_t producer_data_size)
int64_tset_proposed_producers_ex(uint64_t producer_data_format, char * producer_data, uint32_t producer_data_size)
uint32_tget_blockchain_parameters_packed(char * data, uint32_t datalen)
voidset_blockchain_parameters_packed(char * data, uint32_t datalen)
boolis_privileged(capi_name account)
voidset_privileged(capi_name account, bool is_priv)
boolis_feature_activated(const capi_checksum256 * feature_digest)
voidpreactivate_feature(const capi_checksum256 * feature_digest)
uint32_tget_active_producers(capi_name * producers, uint32_t datalen)
int32_tdb_idx64_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint64_t * secondary)
voiddb_idx64_remove(int32_t iterator)
voiddb_idx64_update(int32_t iterator, capi_name payer, const uint64_t * secondary)
int32_tdb_idx64_find_primary(capi_name code, uint64_t scope, capi_name table, uint64_t * secondary, uint64_t primary)
int32_tdb_idx64_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint64_t secondary, uint64_t primary)
int32_tdb_idx64_lowerbound(capi_name code, uint64_t scope, capi_name table, uint64_t secondary, uint64_t primary)
int32_tdb_idx64_upperbound(capi_name code, uint64_t scope, capi_name table, uint64_t secondary, uint64_t primary)
int32_tdb_idx64_end(capi_name code, uint64_t scope, capi_name table)
int32_tdb_idx64_next(int32_t iterator, uint64_t * primary)
int32_tdb_idx64_previous(int32_t iterator, uint64_t * primary)
int32_tdb_idx128_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint128_t * secondary)
voiddb_idx128_remove(int32_t iterator)
voiddb_idx128_update(int32_t iterator, capi_name payer, const uint128_t * secondary)
int32_tdb_idx128_find_primary(capi_name code, uint64_t scope, capi_name table, uint128_t * secondary, uint64_t primary)
int32_tdb_idx128_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint128_t secondary, uint64_t primary)
int32_tdb_idx128_lowerbound(capi_name code, uint64_t scope, capi_name table, uint128_t secondary, uint64_t primary)
int32_tdb_idx128_upperbound(capi_name code, uint64_t scope, capi_name table, uint128_t secondary, uint64_t primary)
int32_tdb_idx128_end(capi_name code, uint64_t scope, capi_name table)
int32_tdb_idx128_next(int32_t iterator, uint64_t * primary)
int32_tdb_idx128_previous(int32_t iterator, uint64_t * primary)
int32_tdb_idx256_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint128_t * data, uint32_t datalen)
voiddb_idx256_remove(int32_t iterator)
voiddb_idx256_update(int32_t iterator, capi_name payer, const uint128_t * data, uint32_t datalen)
int32_tdb_idx256_find_primary(capi_name code, uint64_t scope, capi_name table, uint128_t * data, uint32_t datalen, uint64_t primary)
int32_tdb_idx256_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint128_t data, uint32_t datalen, uint64_t primary)
int32_tdb_idx256_lowerbound(capi_name code, uint64_t scope, capi_name table, uint128_t data, uint32_t datalen, uint64_t primary)
int32_tdb_idx256_upperbound(capi_name code, uint64_t scope, capi_name table, uint128_t data, uint32_t datalen, uint64_t primary)
int32_tdb_idx256_end(capi_name code, uint64_t scope, capi_name table)
int32_tdb_idx256_next(int32_t iterator, uint64_t * primary)
int32_tdb_idx256_previous(int32_t iterator, uint64_t * primary)
int32_tdb_idx_double_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const double * secondary)
voiddb_idx_double_remove(int32_t iterator)
voiddb_idx_double_update(int32_t iterator, capi_name payer, const double * secondary)
int32_tdb_idx_double_find_primary(capi_name code, uint64_t scope, capi_name table, double * secondary, uint64_t primary)
int32_tdb_idx_double_find_secondary(capi_name code, uint64_t scope, capi_name table, const double secondary, uint64_t primary)
int32_tdb_idx_double_lowerbound(capi_name code, uint64_t scope, capi_name table, double secondary, uint64_t primary)
int32_tdb_idx_double_upperbound(capi_name code, uint64_t scope, capi_name table, double secondary, uint64_t primary)
int32_tdb_idx_double_end(capi_name code, uint64_t scope, capi_name table)
int32_tdb_idx_double_next(int32_t iterator, uint64_t * primary)
int32_tdb_idx_double_previous(int32_t iterator, uint64_t * primary)
int32_tdb_idx_long_double_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const long double * secondary)
voiddb_idx_long_double_remove(int32_t iterator)
voiddb_idx_long_double_update(int32_t iterator, capi_name payer, const long double * secondary)
int32_tdb_idx_long_double_find_primary(capi_name code, uint64_t scope, capi_name table, long double * secondary, uint64_t primary)
int32_tdb_idx_long_double_find_secondary(capi_name code, uint64_t scope, capi_name table, const long double secondary, uint64_t primary)
int32_tdb_idx_long_double_lowerbound(capi_name code, uint64_t scope, capi_name table, long double secondary, uint64_t primary)
int32_tdb_idx_long_double_upperbound(capi_name code, uint64_t scope, capi_name table, long double secondary, uint64_t primary)
int32_tdb_idx_long_double_end(capi_name code, uint64_t scope, capi_name table)
int32_tdb_idx_long_double_next(int32_t iterator, uint64_t * primary)
int32_tdb_idx_long_double_previous(int32_t iterator, uint64_t * primary)
int32_tdb_store_i64(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const void * data, uint32_t len)
voiddb_update_i64(int32_t iterator, capi_name payer, const void * data, uint32_t len)
voiddb_remove_i64(int32_t iterator)
int32_tdb_get_i64(int32_t iterator, const void * data, uint32_t len)
int32_tdb_next_i64(int32_t iterator, uint64_t * primary)
int32_tdb_previous_i64(int32_t iterator, uint64_t * primary)
int32_tdb_find_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id)
int32_tdb_lowerbound_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id)
int32_tdb_upperbound_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id)
int32_tdb_end_i64(capi_name code, uint64_t scope, capi_name table)
voidassert_recover_key(const capi_checksum256 digest, const char sig, size_t siglen, const char * pub, size_t publen)
intrecover_key(const capi_checksum256 digest, const char sig, size_t siglen, char * pub, size_t publen)
voidassert_sha256(const char data, uint32_t length, const capi_checksum256 hash)
voidassert_sha1(const char data, uint32_t length, const capi_checksum160 hash)
voidassert_sha512(const char data, uint32_t length, const capi_checksum512 hash)
voidassert_ripemd160(const char data, uint32_t length, const capi_checksum160 hash)
voidsha256(const char data, uint32_t length, capi_checksum256 hash)
voidsha1(const char data, uint32_t length, capi_checksum160 hash)
voidsha512(const char data, uint32_t length, capi_checksum512 hash)
voidripemd160(const char data, uint32_t length, capi_checksum160 hash)
int32_tcheck_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)
int32_tcheck_permission_authorization(capi_name account, capi_name permission, const char pubkeys_data, uint32_t pubkeys_size, const char perms_data, uint32_t perms_size, uint64_t delay_us)
int64_tget_permission_last_used(capi_name account, capi_name permission)
int64_tget_account_creation_time(capi_name account)
uint64_tcurrent_time()
uint64_tpublication_time()
uint32_tread_action_data(void * msg, uint32_t len)
uint32_taction_data_size()
capi_namecurrent_receiver()
voidset_action_return_value(void * rv, size_t len)
voidrequire_recipient(capi_name name)
voidrequire_auth(capi_name name)
voidrequire_auth2(capi_name name, capi_name permission)
boolhas_auth(capi_name name)
boolis_account(capi_name name)
size_tread_transaction(char * buffer, size_t size)
size_ttransaction_size()
uint32_texpiration()
inttapos_block_prefix()
inttapos_block_num()
intget_action(uint32_t type, uint32_t index, char * buff, size_t size)
voidsend_inline(char * serialized_action, size_t size)
voidsend_context_free_inline(char * serialized_action, size_t size)
voidsend_deferred(const uint128_t sender_id, capi_name payer, const char serialized_transaction, size_t size, uint32_t replace_existing)
intcancel_deferred(const uint128_t * sender_id)
intget_context_free_data(uint32_t index, char * buff, size_t size)
capi_nameget_sender()
float_eosio_f32_add(float a, float b)
float_eosio_f32_sub(float a, float b)
float_eosio_f32_div(float a, float b)
float_eosio_f32_mul(float a, float b)
float_eosio_f32_min(float af, float bf)
float_eosio_f32_max(float af, float bf)
float_eosio_f32_copysign(float af, float bf)
float_eosio_f32_abs(float af)
float_eosio_f32_neg(float af)
float_eosio_f32_sqrt(float a)
float_eosio_f32_ceil(float af)
float_eosio_f32_floor(float af)
float_eosio_f32_trunc(float af)
float_eosio_f32_nearest(float af)
bool_eosio_f32_eq(float a, float b)
bool_eosio_f32_ne(float a, float b)
bool_eosio_f32_lt(float a, float b)
bool_eosio_f32_le(float a, float b)
bool_eosio_f32_gt(float af, float bf)
bool_eosio_f32_ge(float af, float bf)
double_eosio_f64_add(double a, double b)
double_eosio_f64_sub(double a, double b)
double_eosio_f64_div(double a, double b)
double_eosio_f64_mul(double a, double b)
double_eosio_f64_min(double af, double bf)
double_eosio_f64_max(double af, double bf)
double_eosio_f64_copysign(double af, double bf)
double_eosio_f64_abs(double af)
double_eosio_f64_neg(double af)
double_eosio_f64_sqrt(double a)
double_eosio_f64_ceil(double af)
double_eosio_f64_floor(double af)
double_eosio_f64_trunc(double af)
double_eosio_f64_nearest(double af)
bool_eosio_f64_eq(double a, double b)
bool_eosio_f64_ne(double a, double b)
bool_eosio_f64_lt(double a, double b)
bool_eosio_f64_le(double a, double b)
bool_eosio_f64_gt(double af, double bf)
bool_eosio_f64_ge(double af, double bf)
double_eosio_f32_promote(float a)
float_eosio_f64_demote(double a)
int32_t_eosio_f32_trunc_i32s(float af)
int32_t_eosio_f64_trunc_i32s(double af)
uint32_t_eosio_f32_trunc_i32u(float af)
uint32_t_eosio_f64_trunc_i32u(double af)
int64_t_eosio_f32_trunc_i64s(float af)
int64_t_eosio_f64_trunc_i64s(double af)
uint64_t_eosio_f32_trunc_i64u(float af)
uint64_t_eosio_f64_trunc_i64u(double af)
float_eosio_i32_to_f32(int32_t a)
float_eosio_i64_to_f32(int64_t a)
float_eosio_ui32_to_f32(uint32_t a)
float_eosio_ui64_to_f32(uint64_t a)
double_eosio_i32_to_f64(int32_t a)
double_eosio_i64_to_f64(int64_t a)
double_eosio_ui32_to_f64(uint32_t a)
double_eosio_ui64_to_f64(uint64_t a)
voidprints_l(const char * cstr, uint32_t len)
voidprints(const char * cstr)
voidprinti(int64_t value)
voidprintui(uint64_t value)
voidprinti128(const int128_t * value)
voidprintui128(const uint128_t * value)
voidprintsf(float value)
voidprintdf(double value)
voidprintqf(const long double * value)
voidprintn(uint64_t nm)
voidprinthex(const void * data, uint32_t len)
void *memset(void * ptr, int value, size_t num)
void *memcpy(void destination, const void source, size_t num)
void *memmove(void destination, const void source, size_t num)
voideosio_assert(uint32_t test, const char * msg)
voideosio_assert_message(uint32_t test, const char * msg, uint32_t len)
voideosio_assert_code(uint32_t test, uint64_t code)
voidabort()
int64_tadd_security_group_participants(const char * data, uint32_t datalen)
int64_tremove_security_group_participants(const char * data, uint32_t datalen)
boolin_active_security_group(const char * data, uint32_t datalen)
uint32_tget_active_security_group(char * data, uint32_t datalen)
int32_tblake2_f(uint32_t rounds, const char state, uint32_t state_len, const char msg, uint32_t msg_len, const char t0_offset, uint32_t t0_len, const char t1_offset, uint32_t t1_len, int32_t final, char * result, uint32_t result_len)
int32_tk1_recover(const char sig, uint32_t sig_len, const char dig, uint32_t dig_len, char * pub, uint32_t pub_len)
int32_talt_bn128_add(const char op1, uint32_t op1_len, const char op2, uint32_t op2_len, char * result, uint32_t result_len)
int32_talt_bn128_mul(const char g1, uint32_t g1_len, const char scalar, uint32_t scalar_len, char * result, uint32_t result_len)
int32_talt_bn128_pair(const char * pairs, uint32_t pairs_len)
int32_tmod_exp(const char base, uint32_t base_len, const char exp, uint32_t exp_len, const char mod, uint32_t mod_len, char result, uint32_t result_len)
voidsha3(const char data, uint32_t data_len, char hash, uint32_t hash_len, int32_t keccak)

Attributes

Name
constexpr uint32_tinv_float_eps
constexpr uint64_tinv_double_eps

Functions Documentation

function get_resource_limits

void get_resource_limits(
capi_name account,
int64_t * ram_bytes,
int64_t * net_weight,
int64_t * cpu_weight
)

function set_resource_limits

void set_resource_limits(
capi_name account,
int64_t ram_bytes,
int64_t net_weight,
int64_t cpu_weight
)

function set_proposed_producers

int64_t set_proposed_producers(
char * producer_data,
uint32_t producer_data_size
)

function set_proposed_producers_ex

int64_t set_proposed_producers_ex(
uint64_t producer_data_format,
char * producer_data,
uint32_t producer_data_size
)

function get_blockchain_parameters_packed

uint32_t get_blockchain_parameters_packed(
char * data,
uint32_t datalen
)

function set_blockchain_parameters_packed

void set_blockchain_parameters_packed(
char * data,
uint32_t datalen
)

function is_privileged

bool is_privileged(
capi_name account
)

function set_privileged

void set_privileged(
capi_name account,
bool is_priv
)

function is_feature_activated

bool is_feature_activated(
const capi_checksum256 * feature_digest
)

function preactivate_feature

void preactivate_feature(
const capi_checksum256 * feature_digest
)

function get_active_producers

uint32_t get_active_producers(
capi_name * producers,
uint32_t datalen
)

function db_idx64_store

int32_t db_idx64_store(
uint64_t scope,
capi_name table,
capi_name payer,
uint64_t id,
const uint64_t * secondary
)

function db_idx64_remove

void db_idx64_remove(
int32_t iterator
)

function db_idx64_update

void db_idx64_update(
int32_t iterator,
capi_name payer,
const uint64_t * secondary
)

function db_idx64_find_primary

int32_t db_idx64_find_primary(
capi_name code,
uint64_t scope,
capi_name table,
uint64_t * secondary,
uint64_t primary
)

function db_idx64_find_secondary

int32_t db_idx64_find_secondary(
capi_name code,
uint64_t scope,
capi_name table,
const uint64_t * secondary,
uint64_t * primary
)

function db_idx64_lowerbound

int32_t db_idx64_lowerbound(
capi_name code,
uint64_t scope,
capi_name table,
uint64_t * secondary,
uint64_t * primary
)

function db_idx64_upperbound

int32_t db_idx64_upperbound(
capi_name code,
uint64_t scope,
capi_name table,
uint64_t * secondary,
uint64_t * primary
)

function db_idx64_end

int32_t db_idx64_end(
capi_name code,
uint64_t scope,
capi_name table
)

function db_idx64_next

int32_t db_idx64_next(
int32_t iterator,
uint64_t * primary
)

function db_idx64_previous

int32_t db_idx64_previous(
int32_t iterator,
uint64_t * primary
)

function db_idx128_store

int32_t db_idx128_store(
uint64_t scope,
capi_name table,
capi_name payer,
uint64_t id,
const uint128_t * secondary
)

function db_idx128_remove

void db_idx128_remove(
int32_t iterator
)

function db_idx128_update

void db_idx128_update(
int32_t iterator,
capi_name payer,
const uint128_t * secondary
)

function db_idx128_find_primary

int32_t db_idx128_find_primary(
capi_name code,
uint64_t scope,
capi_name table,
uint128_t * secondary,
uint64_t primary
)

function db_idx128_find_secondary

int32_t db_idx128_find_secondary(
capi_name code,
uint64_t scope,
capi_name table,
const uint128_t * secondary,
uint64_t * primary
)

function db_idx128_lowerbound

int32_t db_idx128_lowerbound(
capi_name code,
uint64_t scope,
capi_name table,
uint128_t * secondary,
uint64_t * primary
)

function db_idx128_upperbound

int32_t db_idx128_upperbound(
capi_name code,
uint64_t scope,
capi_name table,
uint128_t * secondary,
uint64_t * primary
)

function db_idx128_end

int32_t db_idx128_end(
capi_name code,
uint64_t scope,
capi_name table
)

function db_idx128_next

int32_t db_idx128_next(
int32_t iterator,
uint64_t * primary
)

function db_idx128_previous

int32_t db_idx128_previous(
int32_t iterator,
uint64_t * primary
)

function db_idx256_store

int32_t db_idx256_store(
uint64_t scope,
capi_name table,
capi_name payer,
uint64_t id,
const uint128_t * data,
uint32_t datalen
)

function db_idx256_remove

void db_idx256_remove(
int32_t iterator
)

function db_idx256_update

void db_idx256_update(
int32_t iterator,
capi_name payer,
const uint128_t * data,
uint32_t datalen
)

function db_idx256_find_primary

int32_t db_idx256_find_primary(
capi_name code,
uint64_t scope,
capi_name table,
uint128_t * data,
uint32_t datalen,
uint64_t primary
)

function db_idx256_find_secondary

int32_t db_idx256_find_secondary(
capi_name code,
uint64_t scope,
capi_name table,
const uint128_t * data,
uint32_t datalen,
uint64_t * primary
)

function db_idx256_lowerbound

int32_t db_idx256_lowerbound(
capi_name code,
uint64_t scope,
capi_name table,
uint128_t * data,
uint32_t datalen,
uint64_t * primary
)

function db_idx256_upperbound

int32_t db_idx256_upperbound(
capi_name code,
uint64_t scope,
capi_name table,
uint128_t * data,
uint32_t datalen,
uint64_t * primary
)

function db_idx256_end

int32_t db_idx256_end(
capi_name code,
uint64_t scope,
capi_name table
)

function db_idx256_next

int32_t db_idx256_next(
int32_t iterator,
uint64_t * primary
)

function db_idx256_previous

int32_t db_idx256_previous(
int32_t iterator,
uint64_t * primary
)

function db_idx_double_store

int32_t db_idx_double_store(
uint64_t scope,
capi_name table,
capi_name payer,
uint64_t id,
const double * secondary
)

function db_idx_double_remove

void db_idx_double_remove(
int32_t iterator
)

function db_idx_double_update

void db_idx_double_update(
int32_t iterator,
capi_name payer,
const double * secondary
)

function db_idx_double_find_primary

int32_t db_idx_double_find_primary(
capi_name code,
uint64_t scope,
capi_name table,
double * secondary,
uint64_t primary
)

function db_idx_double_find_secondary

int32_t db_idx_double_find_secondary(
capi_name code,
uint64_t scope,
capi_name table,
const double * secondary,
uint64_t * primary
)

function db_idx_double_lowerbound

int32_t db_idx_double_lowerbound(
capi_name code,
uint64_t scope,
capi_name table,
double * secondary,
uint64_t * primary
)

function db_idx_double_upperbound

int32_t db_idx_double_upperbound(
capi_name code,
uint64_t scope,
capi_name table,
double * secondary,
uint64_t * primary
)

function db_idx_double_end

int32_t db_idx_double_end(
capi_name code,
uint64_t scope,
capi_name table
)

function db_idx_double_next

int32_t db_idx_double_next(
int32_t iterator,
uint64_t * primary
)

function db_idx_double_previous

int32_t db_idx_double_previous(
int32_t iterator,
uint64_t * primary
)

function db_idx_long_double_store

int32_t db_idx_long_double_store(
uint64_t scope,
capi_name table,
capi_name payer,
uint64_t id,
const long double * secondary
)

function db_idx_long_double_remove

void db_idx_long_double_remove(
int32_t iterator
)

function db_idx_long_double_update

void db_idx_long_double_update(
int32_t iterator,
capi_name payer,
const long double * secondary
)

function db_idx_long_double_find_primary

int32_t db_idx_long_double_find_primary(
capi_name code,
uint64_t scope,
capi_name table,
long double * secondary,
uint64_t primary
)

function db_idx_long_double_find_secondary

int32_t db_idx_long_double_find_secondary(
capi_name code,
uint64_t scope,
capi_name table,
const long double * secondary,
uint64_t * primary
)

function db_idx_long_double_lowerbound

int32_t db_idx_long_double_lowerbound(
capi_name code,
uint64_t scope,
capi_name table,
long double * secondary,
uint64_t * primary
)

function db_idx_long_double_upperbound

int32_t db_idx_long_double_upperbound(
capi_name code,
uint64_t scope,
capi_name table,
long double * secondary,
uint64_t * primary
)

function db_idx_long_double_end

int32_t db_idx_long_double_end(
capi_name code,
uint64_t scope,
capi_name table
)

function db_idx_long_double_next

int32_t db_idx_long_double_next(
int32_t iterator,
uint64_t * primary
)

function db_idx_long_double_previous

int32_t db_idx_long_double_previous(
int32_t iterator,
uint64_t * primary
)

function db_store_i64

int32_t db_store_i64(
uint64_t scope,
capi_name table,
capi_name payer,
uint64_t id,
const void * data,
uint32_t len
)

function db_update_i64

void db_update_i64(
int32_t iterator,
capi_name payer,
const void * data,
uint32_t len
)

function db_remove_i64

void db_remove_i64(
int32_t iterator
)

function db_get_i64

int32_t db_get_i64(
int32_t iterator,
const void * data,
uint32_t len
)

function db_next_i64

int32_t db_next_i64(
int32_t iterator,
uint64_t * primary
)

function db_previous_i64

int32_t db_previous_i64(
int32_t iterator,
uint64_t * primary
)

function db_find_i64

int32_t db_find_i64(
capi_name code,
uint64_t scope,
capi_name table,
uint64_t id
)

function db_lowerbound_i64

int32_t db_lowerbound_i64(
capi_name code,
uint64_t scope,
capi_name table,
uint64_t id
)

function db_upperbound_i64

int32_t db_upperbound_i64(
capi_name code,
uint64_t scope,
capi_name table,
uint64_t id
)

function db_end_i64

int32_t db_end_i64(
capi_name code,
uint64_t scope,
capi_name table
)

function assert_recover_key

void assert_recover_key(
const capi_checksum256 * digest,
const char * sig,
size_t siglen,
const char * pub,
size_t publen
)

function recover_key

int recover_key(
const capi_checksum256 * digest,
const char * sig,
size_t siglen,
char * pub,
size_t publen
)

function assert_sha256

void assert_sha256(
const char * data,
uint32_t length,
const capi_checksum256 * hash
)

function assert_sha1

void assert_sha1(
const char * data,
uint32_t length,
const capi_checksum160 * hash
)

function assert_sha512

void assert_sha512(
const char * data,
uint32_t length,
const capi_checksum512 * hash
)

function assert_ripemd160

void assert_ripemd160(
const char * data,
uint32_t length,
const capi_checksum160 * hash
)

function sha256

void sha256(
const char * data,
uint32_t length,
capi_checksum256 * hash
)

function sha1

void sha1(
const char * data,
uint32_t length,
capi_checksum160 * hash
)

function sha512

void sha512(
const char * data,
uint32_t length,
capi_checksum512 * hash
)

function ripemd160

void ripemd160(
const char * data,
uint32_t length,
capi_checksum160 * hash
)

function check_transaction_authorization

int32_t 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
)

function check_permission_authorization

int32_t check_permission_authorization(
capi_name account,
capi_name permission,
const char * pubkeys_data,
uint32_t pubkeys_size,
const char * perms_data,
uint32_t perms_size,
uint64_t delay_us
)

function get_permission_last_used

int64_t get_permission_last_used(
capi_name account,
capi_name permission
)

function get_account_creation_time

int64_t get_account_creation_time(
capi_name account
)

function current_time

uint64_t current_time()

function publication_time

uint64_t publication_time()

function read_action_data

uint32_t read_action_data(
void * msg,
uint32_t len
)

function action_data_size

uint32_t action_data_size()

function current_receiver

capi_name current_receiver()

function set_action_return_value

void set_action_return_value(
void * rv,
size_t len
)

function require_recipient

void require_recipient(
capi_name name
)

function require_auth

void require_auth(
capi_name name
)

function require_auth2

void require_auth2(
capi_name name,
capi_name permission
)

function has_auth

bool has_auth(
capi_name name
)

function is_account

bool is_account(
capi_name name
)

function read_transaction

size_t read_transaction(
char * buffer,
size_t size
)

function transaction_size

size_t transaction_size()

function expiration

uint32_t expiration()

function tapos_block_prefix

int tapos_block_prefix()

function tapos_block_num

int tapos_block_num()

function get_action

int get_action(
uint32_t type,
uint32_t index,
char * buff,
size_t size
)

function send_inline

void send_inline(
char * serialized_action,
size_t size
)

function send_context_free_inline

void send_context_free_inline(
char * serialized_action,
size_t size
)

function send_deferred

void send_deferred(
const uint128_t * sender_id,
capi_name payer,
const char * serialized_transaction,
size_t size,
uint32_t replace_existing
)

function cancel_deferred

int cancel_deferred(
const uint128_t * sender_id
)

function get_context_free_data

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

function get_sender

capi_name get_sender()

function _eosio_f32_add

float _eosio_f32_add(
float a,
float b
)

function _eosio_f32_sub

float _eosio_f32_sub(
float a,
float b
)

function _eosio_f32_div

float _eosio_f32_div(
float a,
float b
)

function _eosio_f32_mul

float _eosio_f32_mul(
float a,
float b
)

function _eosio_f32_min

float _eosio_f32_min(
float af,
float bf
)

function _eosio_f32_max

float _eosio_f32_max(
float af,
float bf
)

function _eosio_f32_copysign

float _eosio_f32_copysign(
float af,
float bf
)

function _eosio_f32_abs

float _eosio_f32_abs(
float af
)

function _eosio_f32_neg

float _eosio_f32_neg(
float af
)

function _eosio_f32_sqrt

float _eosio_f32_sqrt(
float a
)

function _eosio_f32_ceil

float _eosio_f32_ceil(
float af
)

function _eosio_f32_floor

float _eosio_f32_floor(
float af
)

function _eosio_f32_trunc

float _eosio_f32_trunc(
float af
)

function _eosio_f32_nearest

float _eosio_f32_nearest(
float af
)

function _eosio_f32_eq

bool _eosio_f32_eq(
float a,
float b
)

function _eosio_f32_ne

bool _eosio_f32_ne(
float a,
float b
)

function _eosio_f32_lt

bool _eosio_f32_lt(
float a,
float b
)

function _eosio_f32_le

bool _eosio_f32_le(
float a,
float b
)

function _eosio_f32_gt

bool _eosio_f32_gt(
float af,
float bf
)

function _eosio_f32_ge

bool _eosio_f32_ge(
float af,
float bf
)

function _eosio_f64_add

double _eosio_f64_add(
double a,
double b
)

function _eosio_f64_sub

double _eosio_f64_sub(
double a,
double b
)

function _eosio_f64_div

double _eosio_f64_div(
double a,
double b
)

function _eosio_f64_mul

double _eosio_f64_mul(
double a,
double b
)

function _eosio_f64_min

double _eosio_f64_min(
double af,
double bf
)

function _eosio_f64_max

double _eosio_f64_max(
double af,
double bf
)

function _eosio_f64_copysign

double _eosio_f64_copysign(
double af,
double bf
)

function _eosio_f64_abs

double _eosio_f64_abs(
double af
)

function _eosio_f64_neg

double _eosio_f64_neg(
double af
)

function _eosio_f64_sqrt

double _eosio_f64_sqrt(
double a
)

function _eosio_f64_ceil

double _eosio_f64_ceil(
double af
)

function _eosio_f64_floor

double _eosio_f64_floor(
double af
)

function _eosio_f64_trunc

double _eosio_f64_trunc(
double af
)

function _eosio_f64_nearest

double _eosio_f64_nearest(
double af
)

function _eosio_f64_eq

bool _eosio_f64_eq(
double a,
double b
)

function _eosio_f64_ne

bool _eosio_f64_ne(
double a,
double b
)

function _eosio_f64_lt

bool _eosio_f64_lt(
double a,
double b
)

function _eosio_f64_le

bool _eosio_f64_le(
double a,
double b
)

function _eosio_f64_gt

bool _eosio_f64_gt(
double af,
double bf
)

function _eosio_f64_ge

bool _eosio_f64_ge(
double af,
double bf
)

function _eosio_f32_promote

double _eosio_f32_promote(
float a
)

function _eosio_f64_demote

float _eosio_f64_demote(
double a
)

function _eosio_f32_trunc_i32s

int32_t _eosio_f32_trunc_i32s(
float af
)

function _eosio_f64_trunc_i32s

int32_t _eosio_f64_trunc_i32s(
double af
)

function _eosio_f32_trunc_i32u

uint32_t _eosio_f32_trunc_i32u(
float af
)

function _eosio_f64_trunc_i32u

uint32_t _eosio_f64_trunc_i32u(
double af
)

function _eosio_f32_trunc_i64s

int64_t _eosio_f32_trunc_i64s(
float af
)

function _eosio_f64_trunc_i64s

int64_t _eosio_f64_trunc_i64s(
double af
)

function _eosio_f32_trunc_i64u

uint64_t _eosio_f32_trunc_i64u(
float af
)

function _eosio_f64_trunc_i64u

uint64_t _eosio_f64_trunc_i64u(
double af
)

function _eosio_i32_to_f32

float _eosio_i32_to_f32(
int32_t a
)

function _eosio_i64_to_f32

float _eosio_i64_to_f32(
int64_t a
)

function _eosio_ui32_to_f32

float _eosio_ui32_to_f32(
uint32_t a
)

function _eosio_ui64_to_f32

float _eosio_ui64_to_f32(
uint64_t a
)

function _eosio_i32_to_f64

double _eosio_i32_to_f64(
int32_t a
)

function _eosio_i64_to_f64

double _eosio_i64_to_f64(
int64_t a
)

function _eosio_ui32_to_f64

double _eosio_ui32_to_f64(
uint32_t a
)

function _eosio_ui64_to_f64

double _eosio_ui64_to_f64(
uint64_t a
)

function prints_l

void prints_l(
const char * cstr,
uint32_t len
)

function prints

void prints(
const char * cstr
)

function printi

void printi(
int64_t value
)

function printui

void printui(
uint64_t value
)

function printi128

void printi128(
const int128_t * value
)

function printui128

void printui128(
const uint128_t * value
)

function printsf

void printsf(
float value
)

function printdf

void printdf(
double value
)

function printqf

void printqf(
const long double * value
)

function printn

void printn(
uint64_t nm
)

function printhex

void printhex(
const void * data,
uint32_t len
)

function memset

void * memset(
void * ptr,
int value,
size_t num
)

function memcpy

void * memcpy(
void * destination,
const void * source,
size_t num
)

function memmove

void * memmove(
void * destination,
const void * source,
size_t num
)

function eosio_assert

void eosio_assert(
uint32_t test,
const char * msg
)

function eosio_assert_message

void eosio_assert_message(
uint32_t test,
const char * msg,
uint32_t len
)

function eosio_assert_code

void eosio_assert_code(
uint32_t test,
uint64_t code
)

function abort

void abort()

function add_security_group_participants

int64_t add_security_group_participants(
const char * data,
uint32_t datalen
)

function remove_security_group_participants

int64_t remove_security_group_participants(
const char * data,
uint32_t datalen
)

function in_active_security_group

bool in_active_security_group(
const char * data,
uint32_t datalen
)

function get_active_security_group

uint32_t get_active_security_group(
char * data,
uint32_t datalen
)

function blake2_f

int32_t blake2_f(
uint32_t rounds,
const char * state,
uint32_t state_len,
const char * msg,
uint32_t msg_len,
const char * t0_offset,
uint32_t t0_len,
const char * t1_offset,
uint32_t t1_len,
int32_t final,
char * result,
uint32_t result_len
)

function k1_recover

int32_t k1_recover(
const char * sig,
uint32_t sig_len,
const char * dig,
uint32_t dig_len,
char * pub,
uint32_t pub_len
)

Parameters:

  • sig - signature.
  • sig_len - size of signature
  • dig - digest of the message that was signed.
  • dig_len - size of digest
  • pub - public key result
  • pub_len - size of public key result

Return: -1 if there was an error 0 otherwise.

Calculates the uncompressed public key used for a given signature on a given digest.

function alt_bn128_add

int32_t alt_bn128_add(
const char * op1,
uint32_t op1_len,
const char * op2,
uint32_t op2_len,
char * result,
uint32_t result_len
)

function alt_bn128_mul

int32_t alt_bn128_mul(
const char * g1,
uint32_t g1_len,
const char * scalar,
uint32_t scalar_len,
char * result,
uint32_t result_len
)

function alt_bn128_pair

int32_t alt_bn128_pair(
const char * pairs,
uint32_t pairs_len
)

function mod_exp

int32_t mod_exp(
const char * base,
uint32_t base_len,
const char * exp,
uint32_t exp_len,
const char * mod,
uint32_t mod_len,
char * result,
uint32_t result_len
)

function sha3

void sha3(
const char * data,
uint32_t data_len,
char * hash,
uint32_t hash_len,
int32_t keccak
)

Attributes Documentation

variable inv_float_eps

static constexpr uint32_t inv_float_eps = 0x4B000000;

variable inv_double_eps

static constexpr uint64_t inv_double_eps = 0x4330000000000000;

Source code

#include <eosio/action.h>
#include <eosio/chain.h>
#include <eosio/crypto.h>
#include <eosio/db.h>
#include <eosio/permission.h>
#include <eosio/print.h>
#include <eosio/privileged.h>
#include <eosio/system.h>
#include <eosio/transaction.h>
#include <eosio/types.h>
#include "native/eosio/intrinsics.hpp"
#include "native/eosio/crt.hpp"
#include <softfloat.hpp>
#include <float.h>

// Boilerplate
using namespace eosio::native;
extern "C" {
void get_resource_limits( capi_name account, int64_t* ram_bytes, int64_t* net_weight, int64_t* cpu_weight ) {
return intrinsics::get().call<intrinsics::get_resource_limits>(account, ram_bytes, net_weight, cpu_weight);
}
void set_resource_limits( capi_name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight ) {
return intrinsics::get().call<intrinsics::set_resource_limits>(account, ram_bytes, net_weight, cpu_weight);
}
int64_t set_proposed_producers( char *producer_data, uint32_t producer_data_size ) {
return intrinsics::get().call<intrinsics::set_proposed_producers>(producer_data, producer_data_size);
}
int64_t set_proposed_producers_ex( uint64_t producer_data_format, char *producer_data, uint32_t producer_data_size ) {
return intrinsics::get().call<intrinsics::set_proposed_producers_ex>(producer_data_format, producer_data, producer_data_size);
}
uint32_t get_blockchain_parameters_packed( char* data, uint32_t datalen ) {
return intrinsics::get().call<intrinsics::get_blockchain_parameters_packed>(data, datalen);
}
void set_blockchain_parameters_packed( char* data, uint32_t datalen ) {
return intrinsics::get().call<intrinsics::set_blockchain_parameters_packed>(data, datalen);
}
bool is_privileged( capi_name account ) {
return intrinsics::get().call<intrinsics::is_privileged>(account);
}
void set_privileged( capi_name account, bool is_priv ) {
return intrinsics::get().call<intrinsics::set_privileged>(account, is_priv);
}
bool is_feature_activated( const capi_checksum256* feature_digest ) {
return intrinsics::get().call<intrinsics::is_feature_activated>(feature_digest);
}
void preactivate_feature( const capi_checksum256* feature_digest ) {
return intrinsics::get().call<intrinsics::preactivate_feature>(feature_digest);
}
uint32_t get_active_producers( capi_name* producers, uint32_t datalen ) {
return intrinsics::get().call<intrinsics::get_active_producers>(producers, datalen);
}
int32_t db_idx64_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint64_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx64_store>(scope, table, payer, id, secondary);
}
void db_idx64_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx64_remove>(iterator);
}
void db_idx64_update(int32_t iterator, capi_name payer, const uint64_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx64_update>(iterator, payer, secondary);
}
int32_t db_idx64_find_primary(capi_name code, uint64_t scope, capi_name table, uint64_t* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx64_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx64_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint64_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx64_lowerbound(capi_name code, uint64_t scope, capi_name table, uint64_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx64_upperbound(capi_name code, uint64_t scope, capi_name table, uint64_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx64_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx64_end>(code, scope, table);
}
int32_t db_idx64_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_next>(iterator, primary);
}
int32_t db_idx64_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_previous>(iterator, primary);
}
int32_t db_idx128_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint128_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx128_store>(scope, table, payer, id, secondary);
}
void db_idx128_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx128_remove>(iterator);
}
void db_idx128_update(int32_t iterator, capi_name payer, const uint128_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx128_update>(iterator, payer, secondary);
}
int32_t db_idx128_find_primary(capi_name code, uint64_t scope, capi_name table, uint128_t* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx128_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx128_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint128_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx128_lowerbound(capi_name code, uint64_t scope, capi_name table, uint128_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx128_upperbound(capi_name code, uint64_t scope, capi_name table, uint128_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx128_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx128_end>(code, scope, table);
}
int32_t db_idx128_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_next>(iterator, primary);
}
int32_t db_idx128_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_previous>(iterator, primary);
}
int32_t db_idx256_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint128_t* data, uint32_t datalen) {
return intrinsics::get().call<intrinsics::db_idx256_store>(scope, table, payer, id, data, datalen);
}
void db_idx256_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx256_remove>(iterator);
}
void db_idx256_update(int32_t iterator, capi_name payer, const uint128_t* data, uint32_t datalen) {
return intrinsics::get().call<intrinsics::db_idx256_update>(iterator, payer, data, datalen);
}
int32_t db_idx256_find_primary(capi_name code, uint64_t scope, capi_name table, uint128_t* data, uint32_t datalen, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx256_find_primary>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint128_t* data, uint32_t datalen, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_find_secondary>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_lowerbound(capi_name code, uint64_t scope, capi_name table, uint128_t* data, uint32_t datalen, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_lowerbound>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_upperbound(capi_name code, uint64_t scope, capi_name table, uint128_t* data, uint32_t datalen, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_upperbound>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx256_end>(code, scope, table);
}
int32_t db_idx256_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_next>(iterator, primary);
}
int32_t db_idx256_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_previous>(iterator, primary);
}
int32_t db_idx_double_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_double_store>(scope, table, payer, id, secondary);
}
void db_idx_double_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx_double_remove>(iterator);
}
void db_idx_double_update(int32_t iterator, capi_name payer, const double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_double_update>(iterator, payer, secondary);
}
int32_t db_idx_double_find_primary(capi_name code, uint64_t scope, capi_name table, double* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx_double_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_find_secondary(capi_name code, uint64_t scope, capi_name table, const double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_lowerbound(capi_name code, uint64_t scope, capi_name table, double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_upperbound(capi_name code, uint64_t scope, capi_name table, double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx_double_end>(code, scope, table);
}
int32_t db_idx_double_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_next>(iterator, primary);
}
int32_t db_idx_double_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_previous>(iterator, primary);
}
int32_t db_idx_long_double_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const long double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_store>(scope, table, payer, id, secondary);
}
void db_idx_long_double_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx_long_double_remove>(iterator);
}
void db_idx_long_double_update(int32_t iterator, capi_name payer, const long double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_update>(iterator, payer, secondary);
}
int32_t db_idx_long_double_find_primary(capi_name code, uint64_t scope, capi_name table, long double* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_find_secondary(capi_name code, uint64_t scope, capi_name table, const long double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_lowerbound(capi_name code, uint64_t scope, capi_name table, long double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_upperbound(capi_name code, uint64_t scope, capi_name table, long double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx_long_double_end>(code, scope, table);
}
int32_t db_idx_long_double_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_next>(iterator, primary);
}
int32_t db_idx_long_double_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_previous>(iterator, primary);
}
int32_t db_store_i64(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::db_store_i64>(scope, table, payer, id, data, len);
}
void db_update_i64(int32_t iterator, capi_name payer, const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::db_update_i64>(iterator, payer, data, len);
}
void db_remove_i64(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_remove_i64>(iterator);
}
int32_t db_get_i64(int32_t iterator, const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::db_get_i64>(iterator, data, len);
}
int32_t db_next_i64(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_next_i64>(iterator, primary);
}
int32_t db_previous_i64(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_previous_i64>(iterator, primary);
}
int32_t db_find_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id) {
return intrinsics::get().call<intrinsics::db_find_i64>(code, scope, table, id);
}
int32_t db_lowerbound_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id) {
return intrinsics::get().call<intrinsics::db_lowerbound_i64>(code, scope, table, id);
}
int32_t db_upperbound_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id) {
return intrinsics::get().call<intrinsics::db_upperbound_i64>(code, scope, table, id);
}
int32_t db_end_i64(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_end_i64>(code, scope, table);
}
void assert_recover_key( const capi_checksum256* digest, const char* sig, size_t siglen, const char* pub, size_t publen ) {
return intrinsics::get().call<intrinsics::assert_recover_key>(digest, sig, siglen, pub, publen);
}
int recover_key( const capi_checksum256* digest, const char* sig, size_t siglen, char* pub, size_t publen ) {
return intrinsics::get().call<intrinsics::recover_key>(digest, sig, siglen, pub, publen);
}
void assert_sha256( const char* data, uint32_t length, const capi_checksum256* hash ) {
return intrinsics::get().call<intrinsics::assert_sha256>(data, length, hash);
}
void assert_sha1( const char* data, uint32_t length, const capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::assert_sha1>(data, length, hash);
}
void assert_sha512( const char* data, uint32_t length, const capi_checksum512* hash ) {
return intrinsics::get().call<intrinsics::assert_sha512>(data, length, hash);
}
void assert_ripemd160( const char* data, uint32_t length, const capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::assert_ripemd160>(data, length, hash);
}
void sha256( const char* data, uint32_t length, capi_checksum256* hash ) {
return intrinsics::get().call<intrinsics::sha256>(data, length, hash);
}
void sha1( const char* data, uint32_t length, capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::sha1>(data, length, hash);
}
void sha512( const char* data, uint32_t length, capi_checksum512* hash ) {
return intrinsics::get().call<intrinsics::sha512>(data, length, hash);
}
void ripemd160( const char* data, uint32_t length, capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::ripemd160>(data, length, hash);
}
int32_t 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
) {
return intrinsics::get().call<intrinsics::check_transaction_authorization>(trx_data, trx_size, pubkeys_data, pubkeys_size, perms_data, perms_size);
}
int32_t check_permission_authorization( capi_name account, capi_name permission,
const char* pubkeys_data, uint32_t pubkeys_size,
const char* perms_data, uint32_t perms_size, uint64_t delay_us
) {
return intrinsics::get().call<intrinsics::check_permission_authorization>(account, permission, pubkeys_data, pubkeys_size, perms_data, perms_size, delay_us);
}
int64_t get_permission_last_used( capi_name account, capi_name permission ) {
return intrinsics::get().call<intrinsics::get_permission_last_used>(account, permission);
}
int64_t get_account_creation_time( capi_name account ) {
return intrinsics::get().call<intrinsics::get_account_creation_time>(account);
}
uint64_t current_time() {
return intrinsics::get().call<intrinsics::current_time>();
}
uint64_t publication_time() {
return intrinsics::get().call<intrinsics::publication_time>();
}
uint32_t read_action_data( void* msg, uint32_t len ) {
return intrinsics::get().call<intrinsics::read_action_data>(msg, len);
}
uint32_t action_data_size() {
return intrinsics::get().call<intrinsics::action_data_size>();
}
capi_name current_receiver() {
return intrinsics::get().call<intrinsics::current_receiver>();
}
void set_action_return_value( void* rv, size_t len ) {
intrinsics::get().call<intrinsics::set_action_return_value>(rv, len);
}
void require_recipient( capi_name name ) {
return intrinsics::get().call<intrinsics::require_recipient>(name);
}
void require_auth( capi_name name ) {
return intrinsics::get().call<intrinsics::require_auth>(name);
}
void require_auth2( capi_name name, capi_name permission ) {
return intrinsics::get().call<intrinsics::require_auth2>(name, permission);
}
bool has_auth( capi_name name ) {
return intrinsics::get().call<intrinsics::has_auth>(name);
}
bool is_account( capi_name name ) {
return intrinsics::get().call<intrinsics::is_account>(name);
}
size_t read_transaction(char *buffer, size_t size) {
return intrinsics::get().call<intrinsics::read_transaction>(buffer, size);
}
size_t transaction_size() {
return intrinsics::get().call<intrinsics::transaction_size>();
}
uint32_t expiration() {
return intrinsics::get().call<intrinsics::expiration>();
}
int tapos_block_prefix() {
return intrinsics::get().call<intrinsics::tapos_block_prefix>();
}
int tapos_block_num() {
return intrinsics::get().call<intrinsics::tapos_block_num>();
}
int get_action( uint32_t type, uint32_t index, char* buff, size_t size ) {
return intrinsics::get().call<intrinsics::get_action>(type, index, buff, size);
}
void send_inline(char *serialized_action, size_t size) {
return intrinsics::get().call<intrinsics::send_inline>(serialized_action, size);
}
void send_context_free_inline(char *serialized_action, size_t size) {
return intrinsics::get().call<intrinsics::send_context_free_inline>(serialized_action, size);
}
void send_deferred(const uint128_t* sender_id, capi_name payer, const char *serialized_transaction, size_t size, uint32_t replace_existing) {
return intrinsics::get().call<intrinsics::send_deferred>(sender_id, payer, serialized_transaction, size, replace_existing);
}
int cancel_deferred(const uint128_t* sender_id) {
return intrinsics::get().call<intrinsics::cancel_deferred>(sender_id);
}
int get_context_free_data( uint32_t index, char* buff, size_t size ) {
return intrinsics::get().call<intrinsics::get_context_free_data>(index, buff, size);
}
capi_name get_sender() {
return intrinsics::get().call<intrinsics::get_sender>();
}

// softfloat
static constexpr uint32_t inv_float_eps = 0x4B000000;
static constexpr uint64_t inv_double_eps = 0x4330000000000000;

float _eosio_f32_add( float a, float b ) {
float32_t ret = f32_add( to_softfloat32(a), to_softfloat32(b) );
return *reinterpret_cast<float*>(&ret);
}
float _eosio_f32_sub( float a, float b ) {
float32_t ret = f32_sub( to_softfloat32(a), to_softfloat32(b) );
return *reinterpret_cast<float*>(&ret);
}
float _eosio_f32_div( float a, float b ) {
float32_t ret = f32_div( to_softfloat32(a), to_softfloat32(b) );
return *reinterpret_cast<float*>(&ret);
}
float _eosio_f32_mul( float a, float b ) {
float32_t ret = f32_mul( to_softfloat32(a), to_softfloat32(b) );
return *reinterpret_cast<float*>(&ret);
}
float _eosio_f32_min( float af, float bf ) {
float32_t a = to_softfloat32(af);
float32_t b = to_softfloat32(bf);
if (f32_is_nan(a)) {
return af;
}
if (f32_is_nan(b)) {
return bf;
}
if ( f32_sign_bit(a) != f32_sign_bit(b) ) {
return f32_sign_bit(a) ? af : bf;
}
return f32_lt(a,b) ? af : bf;
}
float _eosio_f32_max( float af, float bf ) {
float32_t a = to_softfloat32(af);
float32_t b = to_softfloat32(bf);
if (f32_is_nan(a)) {
return af;
}
if (f32_is_nan(b)) {
return bf;
}
if ( f32_sign_bit(a) != f32_sign_bit(b) ) {
return f32_sign_bit(a) ? bf : af;
}
return f32_lt( a, b ) ? bf : af;
}
float _eosio_f32_copysign( float af, float bf ) {
float32_t a = to_softfloat32(af);
float32_t b = to_softfloat32(bf);
uint32_t sign_of_b = b.v >> 31;
a.v &= ~(1 << 31); // clear the sign bit
a.v = a.v | (sign_of_b << 31); // add the sign of b
return from_softfloat32(a);
}
// float unops
float _eosio_f32_abs( float af ) {
float32_t a = to_softfloat32(af);
a.v &= ~(1 << 31);
return from_softfloat32(a);
}
float _eosio_f32_neg( float af ) {
float32_t a = to_softfloat32(af);
uint32_t sign = a.v >> 31;
a.v &= ~(1 << 31);
a.v |= (!sign << 31);
return from_softfloat32(a);
}
float _eosio_f32_sqrt( float a ) {
float32_t ret = f32_sqrt( to_softfloat32(a) );
return from_softfloat32(ret);
}
// ceil, floor, trunc and nearest are lifted from libc
float _eosio_f32_ceil( float af ) {
float32_t a = to_softfloat32(af);
int e = (int)(a.v >> 23 & 0xFF) - 0X7F;
uint32_t m;
if (e >= 23)
return af;
if (e >= 0) {
m = 0x007FFFFF >> e;
if ((a.v & m) == 0)
return af;
if (a.v >> 31 == 0)
a.v += m;
a.v &= ~m;
} else {
if (a.v >> 31)
a.v = 0x80000000; // return -0.0f
else if (a.v << 1)
a.v = 0x3F800000; // return 1.0f
}

return from_softfloat32(a);
}
float _eosio_f32_floor( float af ) {
float32_t a = to_softfloat32(af);
int e = (int)(a.v >> 23 & 0xFF) - 0X7F;
uint32_t m;
if (e >= 23)
return af;
if (e >= 0) {
m = 0x007FFFFF >> e;
if ((a.v & m) == 0)
return af;
if (a.v >> 31)
a.v += m;
a.v &= ~m;
} else {
if (a.v >> 31 == 0)
a.v = 0;
else if (a.v << 1)
a.v = 0xBF800000; // return -1.0f
}
return from_softfloat32(a);
}
float _eosio_f32_trunc( float af ) {
float32_t a = to_softfloat32(af);
int e = (int)(a.v >> 23 & 0xff) - 0x7f + 9;
uint32_t m;
if (e >= 23 + 9)
return af;
if (e < 9)
e = 1;
m = -1U >> e;
if ((a.v & m) == 0)
return af;
a.v &= ~m;
return from_softfloat32(a);
}
float _eosio_f32_nearest( float af ) {
float32_t a = to_softfloat32(af);
int e = a.v>>23 & 0xff;
int s = a.v>>31;
float32_t y;
if (e >= 0x7f+23)
return af;
if (s)
y = f32_add( f32_sub( a, float32_t{inv_float_eps} ), float32_t{inv_float_eps} );
else
y = f32_sub( f32_add( a, float32_t{inv_float_eps} ), float32_t{inv_float_eps} );
if (f32_eq( y, {0} ) )
return s ? -0.0f : 0.0f;
return from_softfloat32(y);
}

// float relops
bool _eosio_f32_eq( float a, float b ) { return f32_eq( to_softfloat32(a), to_softfloat32(b) ); }
bool _eosio_f32_ne( float a, float b ) { return !f32_eq( to_softfloat32(a), to_softfloat32(b) ); }
bool _eosio_f32_lt( float a, float b ) { return f32_lt( to_softfloat32(a), to_softfloat32(b) ); }
bool _eosio_f32_le( float a, float b ) { return f32_le( to_softfloat32(a), to_softfloat32(b) ); }
bool _eosio_f32_gt( float af, float bf ) {
float32_t a = to_softfloat32(af);
float32_t b = to_softfloat32(bf);
if (f32_is_nan(a))
return false;
if (f32_is_nan(b))
return false;
return !f32_le( a, b );
}
bool _eosio_f32_ge( float af, float bf ) {
float32_t a = to_softfloat32(af);
float32_t b = to_softfloat32(bf);
if (f32_is_nan(a))
return false;
if (f32_is_nan(b))
return false;
return !f32_lt( a, b );
}

// double binops
double _eosio_f64_add( double a, double b ) {
float64_t ret = f64_add( to_softfloat64(a), to_softfloat64(b) );
return from_softfloat64(ret);
}
double _eosio_f64_sub( double a, double b ) {
float64_t ret = f64_sub( to_softfloat64(a), to_softfloat64(b) );
return from_softfloat64(ret);
}
double _eosio_f64_div( double a, double b ) {
float64_t ret = f64_div( to_softfloat64(a), to_softfloat64(b) );
return from_softfloat64(ret);
}
double _eosio_f64_mul( double a, double b ) {
float64_t ret = f64_mul( to_softfloat64(a), to_softfloat64(b) );
return from_softfloat64(ret);
}
double _eosio_f64_min( double af, double bf ) {
float64_t a = to_softfloat64(af);
float64_t b = to_softfloat64(bf);
if (f64_is_nan(a))
return af;
if (f64_is_nan(b))
return bf;
if (f64_sign_bit(a) != f64_sign_bit(b))
return f64_sign_bit(a) ? af : bf;
return f64_lt( a, b ) ? af : bf;
}
double _eosio_f64_max( double af, double bf ) {
float64_t a = to_softfloat64(af);
float64_t b = to_softfloat64(bf);
if (f64_is_nan(a))
return af;
if (f64_is_nan(b))
return bf;
if (f64_sign_bit(a) != f64_sign_bit(b))
return f64_sign_bit(a) ? bf : af;
return f64_lt( a, b ) ? bf : af;
}
double _eosio_f64_copysign( double af, double bf ) {
float64_t a = to_softfloat64(af);
float64_t b = to_softfloat64(bf);
uint64_t sign_of_b = b.v >> 63;
a.v &= ~(uint64_t(1) << 63); // clear the sign bit
a.v = a.v | (sign_of_b << 63); // add the sign of b
return from_softfloat64(a);
}

// double unops
double _eosio_f64_abs( double af ) {
float64_t a = to_softfloat64(af);
a.v &= ~(uint64_t(1) << 63);
return from_softfloat64(a);
}
double _eosio_f64_neg( double af ) {
float64_t a = to_softfloat64(af);
uint64_t sign = a.v >> 63;
a.v &= ~(uint64_t(1) << 63);
a.v |= (uint64_t(!sign) << 63);
return from_softfloat64(a);
}
double _eosio_f64_sqrt( double a ) {
float64_t ret = f64_sqrt( to_softfloat64(a) );
return from_softfloat64(ret);
}
// ceil, floor, trunc and nearest are lifted from libc
double _eosio_f64_ceil( double af ) {
float64_t a = to_softfloat64( af );
float64_t ret;
int e = a.v >> 52 & 0x7ff;
float64_t y;
if (e >= 0x3ff+52 || f64_eq( a, { 0 } ))
return af;
/* y = int(x) - x, where int(x) is an integer neighbor of x */
if (a.v >> 63)
y = f64_sub( f64_add( f64_sub( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
else
y = f64_sub( f64_sub( f64_add( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
/* special case because of non-nearest rounding modes */
if (e <= 0x3ff-1) {
return a.v >> 63 ? -0.0 : 1.0; //float64_t{0x8000000000000000} : float64_t{0xBE99999A3F800000}; //either -0.0 or 1
}
if (f64_lt( y, to_softfloat64(0) )) {
ret = f64_add( f64_add( a, y ), to_softfloat64(1) ); // 0xBE99999A3F800000 } ); // plus 1
return from_softfloat64(ret);
}
ret = f64_add( a, y );
return from_softfloat64(ret);
}
double _eosio_f64_floor( double af ) {
float64_t a = to_softfloat64( af );
float64_t ret;
int e = a.v >> 52 & 0x7FF;
float64_t y;
if ( a.v == 0x8000000000000000) {
return af;
}
if (e >= 0x3FF+52 || a.v == 0) {
return af;
}
if (a.v >> 63)
y = f64_sub( f64_add( f64_sub( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
else
y = f64_sub( f64_sub( f64_add( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
if (e <= 0x3FF-1) {
return a.v>>63 ? -1.0 : 0.0; //float64_t{0xBFF0000000000000} : float64_t{0}; // -1 or 0
}
if ( !f64_le( y, float64_t{0} ) ) {
ret = f64_sub( f64_add(a,y), to_softfloat64(1.0));
return from_softfloat64(ret);
}
ret = f64_add( a, y );
return from_softfloat64(ret);
}
double _eosio_f64_trunc( double af ) {
float64_t a = to_softfloat64( af );
int e = (int)(a.v >> 52 & 0x7ff) - 0x3ff + 12;
uint64_t m;
if (e >= 52 + 12)
return af;
if (e < 12)
e = 1;
m = -1ULL >> e;
if ((a.v & m) == 0)
return af;
a.v &= ~m;
return from_softfloat64(a);
}

double _eosio_f64_nearest( double af ) {
float64_t a = to_softfloat64( af );
int e = (a.v >> 52 & 0x7FF);
int s = a.v >> 63;
float64_t y;
if ( e >= 0x3FF+52 )
return af;
if ( s )
y = f64_add( f64_sub( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} );
else
y = f64_sub( f64_add( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} );
if ( f64_eq( y, float64_t{0} ) )
return s ? -0.0 : 0.0;
return from_softfloat64(y);
}

// double relops
bool _eosio_f64_eq( double a, double b ) { return f64_eq( to_softfloat64(a), to_softfloat64(b) ); }
bool _eosio_f64_ne( double a, double b ) { return !f64_eq( to_softfloat64(a), to_softfloat64(b) ); }
bool _eosio_f64_lt( double a, double b ) { return f64_lt( to_softfloat64(a), to_softfloat64(b) ); }
bool _eosio_f64_le( double a, double b ) { return f64_le( to_softfloat64(a), to_softfloat64(b) ); }
bool _eosio_f64_gt( double af, double bf ) {
float64_t a = to_softfloat64(af);
float64_t b = to_softfloat64(bf);
if (f64_is_nan(a))
return false;
if (f64_is_nan(b))
return false;
return !f64_le( a, b );
}
bool _eosio_f64_ge( double af, double bf ) {
float64_t a = to_softfloat64(af);
float64_t b = to_softfloat64(bf);
if (f64_is_nan(a))
return false;
if (f64_is_nan(b))
return false;
return !f64_lt( a, b );
}

// float and double conversions
double _eosio_f32_promote( float a ) {
return from_softfloat64(f32_to_f64( to_softfloat32(a)) );
}
float _eosio_f64_demote( double a ) {
return from_softfloat32(f64_to_f32( to_softfloat64(a)) );
}
int32_t _eosio_f32_trunc_i32s( float af ) {
float32_t a = to_softfloat32(af);
if (_eosio_f32_ge(af, 2147483648.0f) || _eosio_f32_lt(af, -2147483648.0f))
eosio_assert(false, "Error, f32.convert_s/i32 overflow" );

if (f32_is_nan(a))
eosio_assert(false, "Error, f32.convert_s/i32 unrepresentable");
return f32_to_i32( to_softfloat32(_eosio_f32_trunc( af )), 0, false );
}
int32_t _eosio_f64_trunc_i32s( double af ) {
float64_t a = to_softfloat64(af);
if (_eosio_f64_ge(af, 2147483648.0) || _eosio_f64_lt(af, -2147483648.0))
eosio_assert(false, "Error, f64.convert_s/i32 overflow");
if (f64_is_nan(a))
eosio_assert(false, "Error, f64.convert_s/i32 unrepresentable");
return f64_to_i32( to_softfloat64(_eosio_f64_trunc( af )), 0, false );
}
uint32_t _eosio_f32_trunc_i32u( float af ) {
float32_t a = to_softfloat32(af);
if (_eosio_f32_ge(af, 4294967296.0f) || _eosio_f32_le(af, -1.0f))
eosio_assert(false, "Error, f32.convert_u/i32 overflow");
if (f32_is_nan(a))
eosio_assert(false, "Error, f32.convert_u/i32 unrepresentable");
return f32_to_ui32( to_softfloat32(_eosio_f32_trunc( af )), 0, false );
}
uint32_t _eosio_f64_trunc_i32u( double af ) {
float64_t a = to_softfloat64(af);
if (_eosio_f64_ge(af, 4294967296.0) || _eosio_f64_le(af, -1.0))
eosio_assert(false, "Error, f64.convert_u/i32 overflow");
if (f64_is_nan(a))
eosio_assert(false, "Error, f64.convert_u/i32 unrepresentable");
return f64_to_ui32( to_softfloat64(_eosio_f64_trunc( af )), 0, false );
}
int64_t _eosio_f32_trunc_i64s( float af ) {
float32_t a = to_softfloat32(af);
if (_eosio_f32_ge(af, 9223372036854775808.0f) || _eosio_f32_lt(af, -9223372036854775808.0f))
eosio_assert(false, "Error, f32.convert_s/i64 overflow");
if (f32_is_nan(a))
eosio_assert(false, "Error, f32.convert_s/i64 unrepresentable");
return f32_to_i64( to_softfloat32(_eosio_f32_trunc( af )), 0, false );
}
int64_t _eosio_f64_trunc_i64s( double af ) {
float64_t a = to_softfloat64(af);
if (_eosio_f64_ge(af, 9223372036854775808.0) || _eosio_f64_lt(af, -9223372036854775808.0))
eosio_assert(false, "Error, f64.convert_s/i64 overflow");
if (f64_is_nan(a))
eosio_assert(false, "Error, f64.convert_s/i64 unrepresentable");

return f64_to_i64( to_softfloat64(_eosio_f64_trunc( af )), 0, false );
}
uint64_t _eosio_f32_trunc_i64u( float af ) {
float32_t a = to_softfloat32(af);
if (_eosio_f32_ge(af, 18446744073709551616.0f) || _eosio_f32_le(af, -1.0f))
eosio_assert(false, "Error, f32.convert_u/i64 overflow");
if (f32_is_nan(a))
eosio_assert(false, "Error, f32.convert_u/i64 unrepresentable");
return f32_to_ui64( to_softfloat32(_eosio_f32_trunc( af )), 0, false );
}
uint64_t _eosio_f64_trunc_i64u( double af ) {
float64_t a = to_softfloat64(af);
if (_eosio_f64_ge(af, 18446744073709551616.0) || _eosio_f64_le(af, -1.0))
eosio_assert(false, "Error, f64.convert_u/i64 overflow");
if (f64_is_nan(a))
eosio_assert(false, "Error, f64.convert_u/i64 unrepresentable");
return f64_to_ui64( to_softfloat64(_eosio_f64_trunc( af )), 0, false );
}
float _eosio_i32_to_f32( int32_t a ) {
return from_softfloat32(i32_to_f32( a ));
}
float _eosio_i64_to_f32( int64_t a ) {
return from_softfloat32(i64_to_f32( a ));
}
float _eosio_ui32_to_f32( uint32_t a ) {
return from_softfloat32(ui32_to_f32( a ));
}
float _eosio_ui64_to_f32( uint64_t a ) {
return from_softfloat32(ui64_to_f32( a ));
}
double _eosio_i32_to_f64( int32_t a ) {
return from_softfloat64(i32_to_f64( a ));
}
double _eosio_i64_to_f64( int64_t a ) {
return from_softfloat64(i64_to_f64( a ));
}
double _eosio_ui32_to_f64( uint32_t a ) {
return from_softfloat64(ui32_to_f64( a ));
}
double _eosio_ui64_to_f64( uint64_t a ) {
return from_softfloat64(ui64_to_f64( a ));
}

void prints_l(const char* cstr, uint32_t len) {
return intrinsics::get().call<intrinsics::prints_l>(cstr, len);
}

void prints(const char* cstr) {
return intrinsics::get().call<intrinsics::prints>(cstr);
}

void printi(int64_t value) {
return intrinsics::get().call<intrinsics::printi>(value);
}

void printui(uint64_t value) {
return intrinsics::get().call<intrinsics::printui>(value);
}

void printi128(const int128_t* value) {
return intrinsics::get().call<intrinsics::printi128>(value);
}

void printui128(const uint128_t* value) {
return intrinsics::get().call<intrinsics::printui128>(value);
}

void printsf(float value) {
return intrinsics::get().call<intrinsics::printsf>(value);
}

void printdf(double value) {
return intrinsics::get().call<intrinsics::printdf>(value);
}

void printqf(const long double* value) {
return intrinsics::get().call<intrinsics::printqf>(value);
}

void printn(uint64_t nm) {
return intrinsics::get().call<intrinsics::printn>(nm);
}

void printhex(const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::printhex>(data, len);
}

void* memset ( void* ptr, int value, size_t num ) {
unsigned char v = value;
char* _ptr = (char*)ptr;
for (int i=0; i < num; i++) {
_ptr[i] = v;
}
return (void*)_ptr;
}
void* memcpy ( void* destination, const void* source, size_t num ) {
char* dest = (char*)destination;
char* src = (char*)source;
for (int i=0; i < num; i++) {
dest[i] = src[i];
}
return (void*)dest;
}

void* memmove ( void* destination, const void* source, size_t num ) {
char tmp_buf[num];
char* dest = (char*)destination;
char* src = (char*)source;
for (int i=0; i < num; i++)
tmp_buf[i] = src[i];
for (int i=0; i < num; i++)
dest[i] = tmp_buf[i];
return (void*)dest;
}

void eosio_assert(uint32_t test, const char* msg) {
if (test == 0) {
_prints(msg, eosio::cdt::output_stream_kind::std_err);
_prints_l("\n", 1, eosio::cdt::output_stream_kind::none);
longjmp(*___env_ptr, 1);
}
}

void eosio_assert_message(uint32_t test, const char* msg, uint32_t len) {
if (test == 0) {
_prints_l(msg, len, eosio::cdt::output_stream_kind::std_err);
_prints_l("\n", 1, eosio::cdt::output_stream_kind::none);
longjmp(*___env_ptr, 1);
}
}

void eosio_assert_code(uint32_t test, uint64_t code) {
if (test == 0) {
char buff[32];
snprintf(buff, 32, "%llu", code);
_prints(buff, eosio::cdt::output_stream_kind::std_err);
_prints_l("\n", 1, eosio::cdt::output_stream_kind::none);
longjmp(*___env_ptr, 1);
}
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-noreturn"
void abort() {
eosio_assert(false, "abort");
}
#pragma clang diagnostic pop

int64_t add_security_group_participants(const char* data, uint32_t datalen) {
return intrinsics::get().call<intrinsics::add_security_group_participants>(data, datalen);
}

int64_t remove_security_group_participants(const char* data, uint32_t datalen){
return intrinsics::get().call<intrinsics::remove_security_group_participants>(data, datalen);
}

bool in_active_security_group(const char* data, uint32_t datalen){
return intrinsics::get().call<intrinsics::in_active_security_group>(data, datalen);
}

uint32_t get_active_security_group(char* data, uint32_t datalen){
return intrinsics::get().call<intrinsics::get_active_security_group>(data, datalen);
}

}

int32_t blake2_f( uint32_t rounds, const char* state, uint32_t state_len, const char* msg, uint32_t msg_len,
const char* t0_offset, uint32_t t0_len, const char* t1_offset, uint32_t t1_len, int32_t final, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::blake2_f>(rounds, state, state_len, msg, msg_len, t0_offset, t0_len, t1_offset, t1_len, final, result, result_len);
}

int32_t k1_recover( const char* sig, uint32_t sig_len, const char* dig, uint32_t dig_len, char* pub, uint32_t pub_len) {
return intrinsics::get().call<intrinsics::k1_recover>(sig, sig_len, dig, dig_len, pub, pub_len);
}

int32_t alt_bn128_add( const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::alt_bn128_add>(op1, op1_len, op2, op2_len, result, result_len);
}

int32_t alt_bn128_mul( const char* g1, uint32_t g1_len, const char* scalar, uint32_t scalar_len, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::alt_bn128_mul>(g1, g1_len, scalar, scalar_len, result, result_len);
}

int32_t alt_bn128_pair( const char* pairs, uint32_t pairs_len) {
return intrinsics::get().call<intrinsics::alt_bn128_pair>(pairs, pairs_len);
}

int32_t mod_exp( const char* base, uint32_t base_len, const char* exp, uint32_t exp_len, const char* mod, uint32_t mod_len, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::mod_exp>(base, base_len, exp, exp_len, mod, mod_len, result, result_len);
}

void sha3( const char* data, uint32_t data_len, char* hash, uint32_t hash_len, int32_t keccak ) {
intrinsics::get().call<intrinsics::sha3>(data, data_len, hash, hash_len, keccak);
}

Updated on 2022-12-05 at 15:38:08 +0000