Scorum
betting_api_objects.hpp
Go to the documentation of this file.
1 #pragma once
2 
7 
9 
10 #define API_QUERY_MAX_LIMIT (100)
11 
12 namespace scorum {
13 namespace app {
14 
16 {
17  game_api_object() = default;
18 
20  : id(obj.id)
21  , uuid(obj.uuid)
22  , json_metadata(fc::to_string(obj.json_metadata))
23  , start_time(obj.start_time)
26  , status(obj.status)
27  , game(obj.game)
28  , markets(obj.markets.begin(), obj.markets.end())
29  , results(obj.results.begin(), obj.results.end())
30  {
31  }
32 
35 
36  std::string moderator;
37  std::string json_metadata;
38 
39  fc::time_point_sec start_time = fc::time_point_sec::min();
40  fc::time_point_sec last_update = fc::time_point_sec::min();
41  fc::time_point_sec bets_resolve_time = time_point_sec::maximum();
42 
45 
46  fc::flat_set<chain::market_type> markets;
47  fc::flat_set<chain::wincase_type> results;
48 };
49 
51 {
52  winner_api_object() = default;
54  : winner({ winner.uuid, winner.better, winner.wincase })
55  , loser({ loser.uuid, loser.better, loser.wincase })
56  , market(market)
57  , profit(loser.stake)
58  , income(winner.stake + loser.stake)
59  {
60  }
61 
65  struct better
66  {
70  };
71 
75 
84 };
85 
89 
90 } // namespace app
91 } // namespace scorum
92 
93 // clang-format off
94 
96  (id)
97  (uuid)
98  (moderator)
99  (json_metadata)
100  (start_time)
101  (last_update)
102  (bets_resolve_time)
103  (status)
104  (game)
105  (markets)
106  (results))
107 
109  (uuid)
110  (name)
111  (wincase))
112 
114  (winner)
115  (loser)
116  (market)
117  (profit)
118  (income))
119 // clang-format on
120 
121 FC_REFLECT_DERIVED(scorum::app::matched_bet_api_object, (scorum::chain::matched_bet_object), BOOST_PP_SEQ_NIL)
122 FC_REFLECT_DERIVED(scorum::app::pending_bet_api_object, (scorum::chain::pending_bet_object), BOOST_PP_SEQ_NIL)
FC_REFLECT(appender_args,(appender)(stream)) FC_REFLECT_DERIVED(file_appender_args
Definition: game.cpp:4
@ market
Rate limiting for all other actions.
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
fc::static_variant< result_home::yes, result_home::no, result_draw::yes, result_draw::no, result_away::yes, result_away::no, round_home::yes, round_home::no, handicap::over, handicap::under, correct_score_home::yes, correct_score_home::no, correct_score_draw::yes, correct_score_draw::no, correct_score_away::yes, correct_score_away::no, correct_score::yes, correct_score::no, goal_home::yes, goal_home::no, goal_both::yes, goal_both::no, goal_away::yes, goal_away::no, total::over, total::under, total_goals_home::over, total_goals_home::under, total_goals_away::over, total_goals_away::under > wincase_type
Definition: market.hpp:128
fc::static_variant< soccer_game, hockey_game > game_type
Definition: game.hpp:14
fc::static_variant< result_home, result_draw, result_away, round_home, handicap, correct_score_home, correct_score_draw, correct_score_away, correct_score, goal_home, goal_both, goal_away, total, total_goals_home, total_goals_away > market_type
Definition: market.hpp:97
Definition: asset.cpp:15
boost::uuids::uuid uuid_type
Definition: types.hpp:53
fc::flat_set< chain::wincase_type > results
game_api_object(const chain::game_object &obj)
fc::flat_set< chain::market_type > markets
Brief information about better.
protocol::asset profit
Winner's net win.
winner_api_object(const chain::market_type &market, const chain::bet_data &winner, const chain::bet_data &loser)
protocol::asset income
Winner's net win + winner's stake.