libraries/testing/tester.cpp
asset tester::get_currency_balance( const account_name& code,
                                       const symbol&       asset_symbol,
                                       const account_name& account ) const {
      const auto& db  = control->get_database();
      const auto* tbl = db.find<contracts::table_id_object, contracts::by_code_scope_table>(boost::make_tuple(code, account, N(account)));
      share_type result = 0;

      // the balance is implied to be 0 if either the table or row does not exist
      if (tbl) {
         const auto *obj = db.find<contracts::key_value_object, contracts::by_scope_primary>(boost::make_tuple(tbl->id, asset_symbol.value()));
         if (obj) {
            fc::datastream<const char *> ds(obj->value.data(), obj->value.size());
            fc::raw::unpack(ds, result);
         }
      }
      return asset(result, asset_symbol);
   }
/**
    *  Reads balance as stored by generic_currency contract
    */
Reads balance as stored by generic_currency contract
Reads balance as stored by generic_currency contract
asset tester::get_currency_balance( const account_name& code,
                                       const symbol&       asset_symbol,
                                       const account_name& account ) const {
      const auto& db  = control->get_database();
      const auto* tbl = db.find<contracts::table_id_object, contracts::by_code_scope_table>(boost::make_tuple(code, account, N(account)));
      share_type result = 0;
      if (tbl) {
         const auto *obj = db.find<contracts::key_value_object, contracts::by_scope_primary>(boost::make_tuple(tbl->id, asset_symbol.value()));
         if (obj) {
            fc::datastream<const char *> ds(obj->value.data(), obj->value.size());
            fc::raw::unpack(ds, result);
         }
      }
      return asset(result, asset_symbol);
   }
asset tester :: get_currency_balance ( const account_name & code , const symbol & asset_symbol , const account_name & account ) const { const auto & db = control -> get_database ( ) ; const auto * tbl = db . find < contracts :: table_id_object , contracts :: by_code_scope_table > ( boost :: make_tuple ( code , account , N ( account ) ) ) ; share_type result = 0 ; if ( tbl ) { const auto * obj = db . find < contracts :: key_value_object , contracts :: by_scope_primary > ( boost :: make_tuple ( tbl -> id , asset_symbol . value ( ) ) ) ; if ( obj ) { fc :: datastream < const char * > ds ( obj -> value . data ( ) , obj -> value . size ( ) ) ; fc :: raw :: unpack ( ds , result ) ; } } return asset ( result , asset_symbol ) ; }
Reads balance as stored by generic_currency contract
Reads balance as stored by generic_currency contract
// the balance is implied to be 0 if either the table or row does not exist