본문으로 건너뛰기

libraries/eosiolib/capi/eosio/system.h

More...

Functions

Name
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_tmsg_len
uint64_tcode

Detailed Description

Copyright: defined in eos/LICENSE

Functions Documentation

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;

Source code


#pragma once
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif

__attribute__((eosio_wasm_import))
void eosio_assert( uint32_t test, const char* msg );

__attribute__((eosio_wasm_import))
void eosio_assert_message( uint32_t test, const char* msg, uint32_t msg_len );

__attribute__((eosio_wasm_import))
void eosio_assert_code( uint32_t test, uint64_t code );

__attribute__((eosio_wasm_import, noreturn))
void eosio_exit( int32_t code );

__attribute__((eosio_wasm_import))
uint64_t current_time( void );

__attribute__((eosio_wasm_import))
uint32_t get_block_num( void );

__attribute__((eosio_wasm_import))
bool is_feature_activated( const struct capi_checksum256* feature_digest );

__attribute__((eosio_wasm_import))
capi_name get_sender( void );

#ifdef __cplusplus
}
#endif

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