From 5459beebb685aab0d7941128eb87f142dcefa102 Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Mon, 24 Jul 2017 10:42:25 -0400 Subject: [PATCH] Add a wallet operation for creating betting market rules --- .../wallet/include/graphene/wallet/wallet.hpp | 8 +++++ libraries/wallet/wallet.cpp | 31 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 2639a546..b92fc9ba 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -1623,11 +1623,19 @@ class wallet_api fc::optional start_time, bool broadcast = false); + signed_transaction propose_create_betting_market_rules( + const string& proposing_account, + fc::time_point_sec expiration_time, + internationalized_string_type name, + internationalized_string_type description, + bool broadcast = false); + signed_transaction propose_create_betting_market_group( const string& proposing_account, fc::time_point_sec expiration_time, internationalized_string_type description, event_id_type event_id, + betting_market_rules_id_type rules_id, asset_id_type asset_id, bool broadcast = false); diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 2ff4545b..5c2532f4 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -5205,11 +5205,41 @@ signed_transaction wallet_api::propose_update_event( } +signed_transaction wallet_api::propose_create_betting_market_rules( + const string& proposing_account, + fc::time_point_sec expiration_time, + internationalized_string_type name, + internationalized_string_type description, + bool broadcast /*= false*/) +{ + FC_ASSERT( !is_locked() ); + const chain_parameters& current_params = get_global_properties().parameters; + + betting_market_rules_create_operation betting_market_rules_create_op; + betting_market_rules_create_op.name = name; + betting_market_rules_create_op.description = description; + + proposal_create_operation prop_op; + prop_op.expiration_time = expiration_time; + prop_op.review_period_seconds = current_params.committee_proposal_review_period; + prop_op.fee_paying_account = get_account(proposing_account).id; + prop_op.proposed_ops.emplace_back( betting_market_rules_create_op ); + current_params.current_fees->set_fee( prop_op.proposed_ops.back().op ); + + signed_transaction tx; + tx.operations.push_back(prop_op); + my->set_operation_fees(tx, current_params.current_fees); + tx.validate(); + + return my->sign_transaction(tx, broadcast); +} + signed_transaction wallet_api::propose_create_betting_market_group( const string& proposing_account, fc::time_point_sec expiration_time, internationalized_string_type description, event_id_type event_id, + betting_market_rules_id_type rules_id, asset_id_type asset_id, bool broadcast /*= false*/) { @@ -5219,6 +5249,7 @@ signed_transaction wallet_api::propose_create_betting_market_group( betting_market_group_create_operation betting_market_group_create_op; betting_market_group_create_op.description = description; betting_market_group_create_op.event_id = event_id; + betting_market_group_create_op.rules_id = rules_id; betting_market_group_create_op.asset_id = asset_id; proposal_create_operation prop_op;