Scorum
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
process_comments_cashout.cpp
Go to the documentation of this file.
2 
4 
5 namespace scorum {
6 namespace chain {
7 namespace database_ns {
8 
10 {
11  debug_log(ctx.get_block_info(), "process_comments_cashout BEGIN");
12 
13  dynamic_global_property_service_i& dgp_service = ctx.services().dynamic_global_property_service();
14  content_reward_fund_scr_service_i& content_reward_fund_scr_service
15  = ctx.services().content_reward_fund_scr_service();
16  content_reward_fund_sp_service_i& content_reward_fund_sp_service = ctx.services().content_reward_fund_sp_service();
17  comment_service_i& comment_service = ctx.services().comment_service();
19 
20  impl.update_decreasing_total_claims(content_reward_fund_scr_service);
21  impl.update_decreasing_total_claims(content_reward_fund_sp_service);
22 
23  comment_service_i::comment_refs_type comments = comment_service.get_by_cashout_time(dgp_service.head_block_time());
25 
26  std::copy_if(comments.begin(), comments.end(), std::back_inserter(voted_comments),
27  [&](const comment_object& c) { return c.net_rshares > 0; });
28 
29  impl.reward(content_reward_fund_scr_service, voted_comments);
30  impl.reward(content_reward_fund_sp_service, voted_comments);
31 
32  for (const comment_object& comment : comments)
33  {
34  impl.close_comment_payout(comment);
35  }
36 
37  debug_log(ctx.get_block_info(), "process_comments_cashout END");
38 }
39 }
40 }
41 }
data_service_factory_i & services() const
Definition: block_tasks.hpp:25
void reward(TFundService &fund_service, const comment_refs_type &comments)
#define debug_log(CTX, FORMAT,...)
Definition: debug_log.hpp:3
Definition: asset.cpp:15
std::vector< typename base_service_i::object_cref_type > comment_refs_type
Definition: comment.hpp:17
virtual comment_refs_type get_by_cashout_time(const fc::time_point_sec &until) const =0
virtual fc::time_point_sec head_block_time() const =0