From 2cd816ec6d7c1a4d67ad59781ab2b27cf2356286 Mon Sep 17 00:00:00 2001 From: Roman Olearski Date: Fri, 1 Sep 2017 16:25:13 +0200 Subject: [PATCH] fixing bet_cancel_operation, added mising fee to reflection --- betting2-nhl | 6 ++- genesis.json | 40 +++++++++++++++++++ .../chain/protocol/betting_market.hpp | 8 +++- .../wallet/include/graphene/wallet/wallet.hpp | 3 +- libraries/wallet/wallet.cpp | 6 +++ 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/betting2-nhl b/betting2-nhl index b39449cf..6ec03f1f 100644 --- a/betting2-nhl +++ b/betting2-nhl @@ -142,7 +142,11 @@ approve_proposal nathan 1.10.11 { "active_approvals_to_add" : [ "init0", "init //place_bet alice "1.21.0" 0 { "amount" : 100 } 20000 20000 true place_bet alice "1.21.0" 1 "123" "PPY" 200 true -place_bet bob "1.21.1" 0 "123" "PPY" 200 true +//place_bet bob "1.21.0" 0 "123" "PPY" 200 true + + +place_bet carol "1.21.1" 0 "123" "PPY" 200 true +cancel_bet carol 1.22.2 1 diff --git a/genesis.json b/genesis.json index aedf53bf..99412cfc 100644 --- a/genesis.json +++ b/genesis.json @@ -251,6 +251,46 @@ } ],[ 59,{} + ],[ + 60,{} + ],[ + 61,{ + "fee": 100000 + } + ],[ + 62,{} + ],[ + 63,{ + "fee": 100000 + } + ],[ + 64,{} + ],[ + 65,{ + "fee": 100000 + } + ],[ + 66,{ + "fee": 100000 + } + ],[ + 67,{ + "fee": 100000 + } + ],[ + 68,{} + ],[ + 69,{ + "fee": 100000 + } + ],[ + 70,{ + "fee": 100000 + } + ],[ + 71,{ + "fee": 100000 + } ] ], "scale": 10000 diff --git a/libraries/chain/include/graphene/chain/protocol/betting_market.hpp b/libraries/chain/include/graphene/chain/protocol/betting_market.hpp index e0e5984c..33ff9abf 100644 --- a/libraries/chain/include/graphene/chain/protocol/betting_market.hpp +++ b/libraries/chain/include/graphene/chain/protocol/betting_market.hpp @@ -299,7 +299,11 @@ struct bet_matched_operation : public base_operation struct bet_cancel_operation : public base_operation { - struct fee_parameters_type { uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION; }; + struct fee_parameters_type + { + uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION; + //uint64_t fee = 0; + }; asset fee; /// the bettor who is cancelling the bet @@ -419,7 +423,7 @@ FC_REFLECT( graphene::chain::bet_matched_operation::fee_parameters_type, ) FC_REFLECT( graphene::chain::bet_matched_operation, (bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) ) FC_REFLECT( graphene::chain::bet_cancel_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::bet_cancel_operation, (bettor_id) (bet_to_cancel) (extensions) ) +FC_REFLECT( graphene::chain::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) ) FC_REFLECT( graphene::chain::bet_canceled_operation::fee_parameters_type, ) FC_REFLECT( graphene::chain::bet_canceled_operation, (bettor_id)(bet_id)(stake_returned) ) diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index ff1a9c4c..945127f1 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -1587,7 +1587,7 @@ class wallet_api global_betting_statistics_object get_global_betting_statistics() const; vector list_events_in_group(event_group_id_type event_group_id) const; vector get_unmatched_bets_for_bettor(betting_market_id_type betting_market_id, account_id_type account_id) const; - + vector get_all_unmatched_bets_for_bettor(account_id_type account_id) const; signed_transaction propose_create_sport( const string& proposing_account, @@ -1991,6 +1991,7 @@ FC_API( graphene::wallet::wallet_api, (list_betting_markets) (list_events_in_group) (get_unmatched_bets_for_bettor) + (get_all_unmatched_bets_for_bettor) (get_global_betting_statistics) (propose_create_sport) (propose_create_event_group) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 46dd287c..5cd3d0bb 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -5071,11 +5071,17 @@ vector wallet_api::list_events_in_group(event_group { return my->_remote_db->list_events_in_group(event_group_id); } + vector wallet_api::get_unmatched_bets_for_bettor(betting_market_id_type betting_market_id, account_id_type account_id) const { return my->_remote_db->get_unmatched_bets_for_bettor(betting_market_id, account_id); } +vector wallet_api::get_all_unmatched_bets_for_bettor(account_id_type account_id) const +{ + return my->_remote_db->get_all_unmatched_bets_for_bettor(account_id); +} + signed_transaction wallet_api::propose_create_sport( const string& proposing_account, fc::time_point_sec expiration_time,