Scorum
global_property_initializator.cpp
Go to the documentation of this file.
3 
5 
7 
8 namespace scorum {
9 namespace chain {
10 namespace genesis {
11 
13 {
14  dynamic_global_property_service_i& dgp_service = ctx.services().dynamic_global_property_service();
15 
16  FC_ASSERT(ctx.genesis_state().total_supply.symbol() == SCORUM_SYMBOL);
17  FC_ASSERT(ctx.genesis_state().founders_supply.symbol() == SP_SYMBOL);
19  FC_ASSERT(ctx.genesis_state().accounts_supply.symbol() == SCORUM_SYMBOL);
20  FC_ASSERT(ctx.genesis_state().rewards_supply.symbol() == SCORUM_SYMBOL);
24 
25  FC_ASSERT(!dgp_service.is_exists());
26 
27  asset circulating_capital = asset(0, SCORUM_SYMBOL);
28  circulating_capital += ctx.genesis_state().accounts_supply;
29 
30  auto founders_supply = ctx.genesis_state().founders_supply.amount;
31  auto steemit_bounty_accounts_supply = ctx.genesis_state().steemit_bounty_accounts_supply.amount;
32 
33  asset total_supply = asset(0, SCORUM_SYMBOL);
34  total_supply += circulating_capital;
35  total_supply += ctx.genesis_state().rewards_supply;
36  total_supply += ctx.genesis_state().registration_supply;
39  total_supply += asset(founders_supply, SCORUM_SYMBOL);
40  total_supply += asset(steemit_bounty_accounts_supply, SCORUM_SYMBOL);
41 
42  FC_ASSERT(ctx.genesis_state().total_supply == total_supply, "Invalid total supply: ${gt} != ${rt}",
43  ("gt", ctx.genesis_state().total_supply)("rt", total_supply));
44 
45  dgp_service.create([&](dynamic_global_property_object& gpo) {
46  gpo.time = ctx.genesis_state().initial_timestamp;
47  gpo.recent_slots_filled = fc::uint128::max_value();
48  gpo.participation_count = 128;
49  gpo.circulating_capital = circulating_capital;
50  gpo.total_supply = total_supply;
51  gpo.median_chain_props.maximum_block_size = SCORUM_MAX_BLOCK_SIZE;
52  });
53 }
54 }
55 }
56 }
uint8_t participation_count
Divide by 128 to compute participation percentage.
fc::uint128_t recent_slots_filled
used to compute witness participation.
asset circulating_capital
Total SCR and SP on circulating (on account balances). circulating_capital <= total_supply.
asset total_supply
Total SCR and SP (circulating_scr + circulating_sp)
const genesis_state_type & genesis_state() const
data_service_factory_i & services() const
#define SP_SYMBOL
Definition: config.hpp:104
#define SCORUM_SYMBOL
Definition: config.hpp:102
Definition: asset.cpp:15
virtual bool is_exists() const =0
virtual const object_type & create(const modifier_type &modifier)=0
asset_symbol_type symbol() const
Definition: asset.hpp:32
share_type amount
Definition: asset.hpp:31