From 510f2f919f6418ebdccc89ff755563c7f961c985 Mon Sep 17 00:00:00 2001 From: Roman Olearski Date: Tue, 25 Jul 2017 09:20:45 +0200 Subject: [PATCH] Add a wallet operation for updating betting market rules --- .../wallet/include/graphene/wallet/wallet.hpp | 10 +++++- libraries/wallet/wallet.cpp | 34 +++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index b92fc9ba..20c46065 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -1615,8 +1615,8 @@ class wallet_api signed_transaction propose_update_event( const string& proposing_account, - event_id_type event_id, fc::time_point_sec expiration_time, + event_id_type event_id, fc::optional event_group_id, fc::optional name, fc::optional season, @@ -1630,6 +1630,14 @@ class wallet_api internationalized_string_type description, bool broadcast = false); + signed_transaction propose_update_betting_market_rules( + const string& proposing_account, + fc::time_point_sec expiration_time, + betting_market_rules_id_type rules_id, + fc::optional name, + fc::optional description, + bool broadcast = false); + signed_transaction propose_create_betting_market_group( const string& proposing_account, fc::time_point_sec expiration_time, diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 5c2532f4..ac2a4a14 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -5171,8 +5171,8 @@ signed_transaction wallet_api::propose_create_event( signed_transaction wallet_api::propose_update_event( const string& proposing_account, - event_id_type event_id, fc::time_point_sec expiration_time, + event_id_type event_id, fc::optional event_group_id, fc::optional name, fc::optional season, @@ -5204,7 +5204,6 @@ signed_transaction wallet_api::propose_update_event( return my->sign_transaction(tx, broadcast); } - signed_transaction wallet_api::propose_create_betting_market_rules( const string& proposing_account, fc::time_point_sec expiration_time, @@ -5234,6 +5233,37 @@ signed_transaction wallet_api::propose_create_betting_market_rules( return my->sign_transaction(tx, broadcast); } +signed_transaction wallet_api::propose_update_betting_market_rules( + const string& proposing_account, + fc::time_point_sec expiration_time, + betting_market_rules_id_type rules_id, + fc::optional name, + fc::optional description, + bool broadcast /*= false*/) +{ + FC_ASSERT( !is_locked() ); + const chain_parameters& current_params = get_global_properties().parameters; + + betting_market_rules_update_operation betting_market_rules_update_op; + betting_market_rules_update_op.betting_market_rules_id = rules_id; + betting_market_rules_update_op.new_name = name; + betting_market_rules_update_op.new_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_update_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,