System
Module: Core API
Defines wrappers over eosio_assert. More...
Functions
Name | |
---|---|
void | eosio_exit(int32_t code) |
time_point | current_time_point() |
block_timestamp | current_block_time() |
block_num_t | current_block_number() |
bool | is_feature_activated(const checksum256 & feature_digest) |
name | get_sender() |
void | check(bool pred, std::string_view msg) |
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) |
attribute((eosio_wasm_import) ) Aborts processing of this action and unwinds all pending changes. | |
attribute((eosio_wasm_import, noreturn) ) |
Attributes
Name | |
---|---|
const char * | msg |
const char uint32_t | msg_len |
uint64_t | code |
Detailed Description
Defines wrappers over eosio_assert.
Defines API for interacting with system level intrinsics.
Defines time related functions and eosio_exit.
Functions Documentation
function eosio_exit
inline void eosio_exit(
int32_t code
)
Parameters:
- code - the exit code Example:
This method will abort execution of wasm without failing the contract. This is used to bypass all cleanup / destructors that would normally be called.
WARNING: this method will immediately abort execution of wasm code that is on the stack and would be executed as the method normally returned. Problems can occur with write-caches, RAII, reference counting when this method aborts execution of wasm code immediately.
eosio_exit(0);
eosio_exit(1);
eosio_exit(2);
eosio_exit(3);
function current_time_point
time_point current_time_point()
Return: time in microseconds from 1970 of the current block as a time_point
Returns the time in microseconds from 1970 of the current block as a time_point
function current_block_time
block_timestamp current_block_time()
Return: time in microseconds from 1970 of the current block as a block_timestamp
Returns the time in microseconds from 1970 of the current block as a block_timestamp
function current_block_number
inline block_num_t current_block_number()
Return: the current block number
Returns the current block number
function is_feature_activated
inline bool is_feature_activated(
const checksum256 & feature_digest
)
Parameters:
- feature_digest - digest of the protocol feature
Return: true if the specified protocol feature has been activated, false otherwise
Check if specified protocol feature has been activated
function get_sender
inline name get_sender()
Return: name of account that sent the current inline action (empty name if not called from inline action)
Return name of account that sent current inline action
function check
inline void check(
bool pred,
std::string_view msg
)
Assert if the predicate fails and use the supplied message.
Example:
eosio::check(a == b, "a does not equal b");
function check
inline void 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
inline void 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
inline void 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
inline void 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
inline void 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
inline void check(
bool pred,
uint64_t code
)
Assert if the predicate fails and use the supplied error code.
Example:
eosio::check(a == b, 13);
function attribute
__attribute__(
(eosio_wasm_import)
)
Aborts processing of this action and unwinds all pending changes.
Parameters:
- test - 0 to abort, 1 to ignore
- msg - a null terminated string explaining the reason for failure
- test - 0 to abort, 1 to ignore
- msg - a pointer to the start of string explaining the reason for failure
- msg_len - length of the string
- test - 0 to abort, 1 to ignore
- code - the error code
- feature_digest - digest of the protocol feature
Return:
- time in microseconds from 1970 of the current block
- current block number
- true if the specified protocol feature has been activated, false otherwise
- name of account that sent the current inline action (empty name if not called from inline action)
Aborts processing of this action and unwinds all pending changes if the test condition is true
Example:
eosio_assert(1 == 2, "One is not equal to two.");
eosio_assert(1 == 1, "One is not equal to one.");
Aborts processing of this action and unwinds all pending changes if the test condition is true
Aborts processing of this action and unwinds all pending changes if the test condition is true
Returns the time in microseconds from 1970 of the current block
Returns the current block number
Check if specified protocol feature has been activated
Return name of account that sent current inline action
function attribute
__attribute__(
(eosio_wasm_import, noreturn)
)
Parameters:
- code - the exit code Example:
This method will abort execution of wasm without failing the contract. This is used to bypass all cleanup / destructors that would normally be called.
eosio_exit(0);
eosio_exit(1);
eosio_exit(2);
eosio_exit(3);
Attributes Documentation
variable msg
const char * msg;
variable msg_len
const char uint32_t msg_len;
variable code
uint64_t code;
Updated on 2022-12-05 at 15:38:08 +0000