Fix the place_bet wallet command to use a more friendly format for specifying

the bet amount and multiplier
This commit is contained in:
Eric Frias 2017-08-16 15:10:11 -04:00
parent 2b2399d8c0
commit 596ab26eb5
2 changed files with 19 additions and 16 deletions

View file

@ -1679,13 +1679,13 @@ class wallet_api
fc::optional<internationalized_string_type> payout_condition,
bool broadcast = false);
signed_transaction place_bet(
const string& betting_account,
betting_market_id_type betting_market_id,
bet_type back_or_lay,
asset amount_to_bet,
bet_multiplier_type backer_multiplier,
bool broadcast = false);
signed_transaction place_bet(string betting_account,
betting_market_id_type betting_market_id,
bet_type back_or_lay,
string amount,
string asset_symbol,
double backer_multiplier,
bool broadcast /*= false*/);
signed_transaction propose_resolve_betting_market_group(
const string& proposing_account,

View file

@ -5400,22 +5400,25 @@ signed_transaction wallet_api::propose_update_betting_market(
return my->sign_transaction(tx, broadcast);
}
signed_transaction wallet_api::place_bet(
const string& betting_account,
betting_market_id_type betting_market_id,
bet_type back_or_lay,
asset amount_to_bet,
bet_multiplier_type backer_multiplier,
bool broadcast /*= false*/)
signed_transaction wallet_api::place_bet(string betting_account,
betting_market_id_type betting_market_id,
bet_type back_or_lay,
string amount,
string asset_symbol,
double backer_multiplier,
bool broadcast /*= false*/)
{
FC_ASSERT( !is_locked() );
fc::optional<asset_object> asset_obj = get_asset(asset_symbol);
FC_ASSERT(asset_obj, "Could not find asset matching ${asset}", ("asset", asset_symbol));
const chain_parameters& current_params = get_global_properties().parameters;
bet_place_operation bet_place_op;
bet_place_op.bettor_id = get_account(betting_account).id;
bet_place_op.betting_market_id = betting_market_id;
bet_place_op.amount_to_bet = amount_to_bet;
bet_place_op.backer_multiplier = backer_multiplier;
bet_place_op.amount_to_bet = asset_obj->amount_from_string(amount);
bet_place_op.backer_multiplier = (bet_multiplier_type)(backer_multiplier * GRAPHENE_BETTING_ODDS_PRECISION);
bet_place_op.back_or_lay = back_or_lay;
signed_transaction tx;