Scorum
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
update_game_round_result_evaluator.cpp
Go to the documentation of this file.
2 
5 
11 
12 namespace scorum {
13 namespace chain {
14 
18  : evaluator_impl<data_service_factory_i, update_game_round_result_evaluator>(services)
19  , _account_dba(account_dba)
20  , _game_round_dba(game_round_dba)
21  , _hardfork_service(services.hardfork_property_service())
22 {
23 }
24 
26 {
27  FC_ASSERT(_hardfork_service.has_hardfork(SCORUM_HARDFORK_0_5), "Hardfork #5 is required");
28  FC_ASSERT(!_hardfork_service.has_hardfork(SCORUM_HARDFORK_0_6), "Disabled since hardfork #6");
29 
30  FC_ASSERT(_game_round_dba.is_exists_by<by_uuid>(op.uuid), R"(Round "${uuid}" must exist.)", ("uuid", op.uuid));
31  FC_ASSERT(_account_dba.is_exists_by<by_name>(op.owner), R"(Account "${owner}" must exist.)", ("owner", op.owner));
32 
33  auto& round = _game_round_dba.get_by<by_uuid>(op.uuid);
34 
35  FC_ASSERT(round.owner == op.owner, "${round.owner} != ${operation.owner}", ("round.owner", round.owner)("operation.owner", op.owner));
36 
37  _game_round_dba.update(round, [&](auto& obj){
38  obj.result = op.result;
39  fc::from_string(obj.vrf, op.vrf);
40  fc::from_string(obj.proof, op.proof);
41  });
42 }
43 
44 } // namespace chain
45 } // namespace scorum
bool is_exists_by(const Key &arg) const
update_game_round_result_evaluator(data_service_factory_i &, dba::db_accessor< account_object > &, dba::db_accessor< game_round_object > &)
Definition: asset.cpp:15
virtual bool has_hardfork(uint32_t hardfork) const =0
This operation update game round results.