提交 ba3ce62d 编写于 作者: B Brian Johnson

Fixed account api based on testing.

上级 6c5f252f
......@@ -14,10 +14,11 @@
extern "C" {
/**
* @brief Return the balance for the provided account
* @brief Retrieve the balance for the provided account
*
* @param balance - a pointer to a range of memory to store balance data
* @param len - length of the range of memory to store balance data
* @ret true if account information is retrieved
*
* @pre data is a valid pointer to a range of memory at least datalen bytes long
* @pre data is a pointer to a balance object
......@@ -31,6 +32,6 @@ extern "C" {
* @endcode
*/
void account_balance_get( void* balance, uint32_t len );
bool account_balance_get( void* balance, uint32_t len );
///@ } accountcapi
}
......@@ -5,7 +5,7 @@
*
*/
#pragma once
#include <eoslib/math.hpp>
#include <eoslib/account.h>
#include <eoslib/print.hpp>
......@@ -75,7 +75,7 @@ struct PACKED (account_balance) {
bool get(account_balance& b)
{
return account_balance(&b, sizeof(account_balance));
return account_balance_get(&b, sizeof(account_balance));
}
} }
......@@ -735,6 +735,8 @@ DEFINE_INTRINSIC_FUNCTION2(env,account_balance_get,account_balance_get,i32,i32,c
account_balance& total_balance = memoryRef<account_balance>( mem, charptr );
wasm.current_apply_context->require_scope(total_balance.account);
auto& db = wasm.current_apply_context->db;
auto* balance = db.find< balance_object,by_owner_name >( total_balance.account );
auto* staked_balance = db.find<staked_balance_object,by_owner_name>( total_balance.account );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册