Skip to content

Commit

Permalink
Return bool from evmc_gen_balance_fn()
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 6, 2018
1 parent 280ff99 commit 1109d62
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion examples/example_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ static enum evmc_storage_status set_storage(evmc_context* context,
return EVMC_STORAGE_UNCHANGED;
}

static void get_balance(evmc_uint256be* result, evmc_context* context, const evmc_address* address)
static bool get_balance(evmc_uint256be* result, evmc_context* context, const evmc_address* address)
{
*result = balance(context, address);
return true;
}

static size_t get_code_size(evmc_context* context, const evmc_address* address)
Expand Down
18 changes: 11 additions & 7 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,18 @@ typedef enum evmc_storage_status (*evmc_set_storage_fn)(struct evmc_context* con
/**
* Get balance callback function.
*
* This callback function is used by an EVM to query the balance of the given
* address.
* @param[out] result The returned balance value.
* @param context The pointer to the Host execution context.
* @see ::evmc_context.
* @param address The address.
* This callback function is used by a VM to query the balance of the given address.
*
* @param[out] result The pointer to the place where to put the result balance.
* The pointed memory is only modified when the function returns true.
* @param context The pointer to the Host execution context.
* @param address The address.
* @return If the account exists its balance is put at the location
* pointed by @p result and true is returned.
* If the account does not exist false is returned without
* modifying the memory pointed by @p result.
*/
typedef void (*evmc_get_balance_fn)(struct evmc_uint256be* result,
typedef bool (*evmc_get_balance_fn)(struct evmc_uint256be* result,
struct evmc_context* context,
const struct evmc_address* address);

Expand Down

0 comments on commit 1109d62

Please sign in to comment.