Scorum
registration_bonus_initializator.cpp
Go to the documentation of this file.
3 
6 
8 
10 
12 
13 namespace scorum {
14 namespace chain {
15 namespace genesis {
16 
18 {
19  registration_pool_service_i& registration_pool_service = ctx.services().registration_pool_service();
20 
21  if (registration_pool_service.is_exists())
22  {
23  account_service_i& account_service = ctx.services().account_service();
24 
25  size_t total_unvested = ctx.genesis_state().accounts.size();
26  for (auto& account : ctx.genesis_state().accounts)
27  {
28  if (registration_pool_service.get().balance.amount > 0)
29  {
30  const auto& account_obj = account_service.get_account(account.name);
31  give_bonus_from_registration_pool_task_context bonus_ctx(ctx.services(), account_obj);
33  give_bonus.apply(bonus_ctx);
34  --total_unvested;
35  }
36  else
37  {
38  wlog("No more bonus from registration pool. ${1} accounts have no SP.", ("1", total_unvested));
39  break;
40  }
41  }
42  }
43 }
44 }
45 }
46 }
const genesis_state_type & genesis_state() const
data_service_factory_i & services() const
void apply(ContextType &ctx)
Definition: tasks_base.hpp:55
Definition: asset.cpp:15
virtual const account_object & get_account(const account_name_type &) const =0
virtual bool is_exists() const =0
virtual const object_type & get() const =0
std::vector< account_type > accounts
share_type amount
Definition: asset.hpp:31