diff --git a/libraries/app/impacted.cpp b/libraries/app/impacted.cpp index 212ff67e..f160e8c7 100644 --- a/libraries/app/impacted.cpp +++ b/libraries/app/impacted.cpp @@ -222,7 +222,10 @@ struct get_impacted_account_visitor { _impacted.insert( op.player_account_id ); } - + void operator()( const tournament_payout_operation& op ) + { + _impacted.insert( op.winner_account_id ); + } }; void operation_get_impacted_accounts( const operation& op, flat_set& result ) diff --git a/libraries/chain/include/graphene/chain/protocol/operations.hpp b/libraries/chain/include/graphene/chain/protocol/operations.hpp index 6e8cd61b..f96f8658 100644 --- a/libraries/chain/include/graphene/chain/protocol/operations.hpp +++ b/libraries/chain/include/graphene/chain/protocol/operations.hpp @@ -97,7 +97,8 @@ namespace graphene { namespace chain { tournament_join_operation, game_move_operation, asset_update_dividend_operation, - asset_dividend_distribution_operation // VIRTUAL + asset_dividend_distribution_operation, // VIRTUAL + tournament_payout_operation // VIRTUAL > operation; /// @} // operations group diff --git a/libraries/chain/include/graphene/chain/protocol/tournament.hpp b/libraries/chain/include/graphene/chain/protocol/tournament.hpp index 6c5299d4..34f9ac29 100644 --- a/libraries/chain/include/graphene/chain/protocol/tournament.hpp +++ b/libraries/chain/include/graphene/chain/protocol/tournament.hpp @@ -163,6 +163,28 @@ namespace graphene { namespace chain { void validate()const; }; + struct tournament_payout_operation : public base_operation + { + struct fee_parameters_type {}; + + asset fee; + + /// The account of the the tournament winner + account_id_type winner_account_id; + + /// The won tournament + tournament_id_type tournament_id; + + /// The buy-in paid by the `payer_account_id` + asset won_prize; + + extensions_type extensions; + + account_id_type fee_payer()const { return winner_account_id; } + share_type calculate_fee(const fee_parameters_type&)const { return 0; } + void validate()const {} + }; + } } FC_REFLECT_TYPENAME( graphene::chain::game_specific_options ) @@ -196,7 +218,15 @@ FC_REFLECT( graphene::chain::game_move_operation, (player_account_id) (move) (extensions)) +FC_REFLECT( graphene::chain::tournament_payout_operation, + (fee) + (winner_account_id) + (tournament_id) + (won_prize) + (extensions)) + FC_REFLECT( graphene::chain::tournament_create_operation::fee_parameters_type, (fee) ) FC_REFLECT( graphene::chain::tournament_join_operation::fee_parameters_type, (fee) ) FC_REFLECT( graphene::chain::game_move_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::chain::tournament_payout_operation::fee_parameters_type, )