added operation tournament_payout_operation

This commit is contained in:
Roman Olearski 2016-11-17 18:04:32 +01:00
parent 935dac7ae6
commit 1530f04882
3 changed files with 36 additions and 2 deletions

View file

@ -222,7 +222,10 @@ struct get_impacted_account_visitor
{ {
_impacted.insert( op.player_account_id ); _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<account_id_type>& result ) void operation_get_impacted_accounts( const operation& op, flat_set<account_id_type>& result )

View file

@ -97,7 +97,8 @@ namespace graphene { namespace chain {
tournament_join_operation, tournament_join_operation,
game_move_operation, game_move_operation,
asset_update_dividend_operation, asset_update_dividend_operation,
asset_dividend_distribution_operation // VIRTUAL asset_dividend_distribution_operation, // VIRTUAL
tournament_payout_operation // VIRTUAL
> operation; > operation;
/// @} // operations group /// @} // operations group

View file

@ -163,6 +163,28 @@ namespace graphene { namespace chain {
void validate()const; 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 ) FC_REFLECT_TYPENAME( graphene::chain::game_specific_options )
@ -196,7 +218,15 @@ FC_REFLECT( graphene::chain::game_move_operation,
(player_account_id) (player_account_id)
(move) (move)
(extensions)) (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_create_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::tournament_join_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::game_move_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::tournament_payout_operation::fee_parameters_type, )