Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Fix comment about inflation rate. #495
Browse files Browse the repository at this point in the history
  • Loading branch information
afalaleev committed Apr 14, 2018
1 parent 1089943 commit 362b88f
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2319,46 +2319,44 @@ namespace golos {
}
}

/**
* Overall the network has an inflation rate of 102% of virtual steem per year
* 90% of inflation is directed to vesting shares
* 10% of inflation is directed to subjective proof of work voting
* 1% of inflation is directed to liquidity providers
* 1% of inflation is directed to block producers
*
* This method pays out vesting and reward shares every block, and liquidity shares once per day.
* This method does not pay out witnesses.
*/
/**
* At a start overall the network has an inflation rate of 15.15% of virtual golos per year.
* Each year the inflation rate is reduced by 0.42% and stops at 0.95% of virtual golos per year in 33 years.
* 66.67% of inflation is directed to content reward pool
* 26.67% of inflation is directed to vesting fund
* 6.66% of inflation is directed to witness pay
*
* This method pays out vesting, reward shares and witnesses every block.
*/
void database::process_funds() {
const auto &props = get_dynamic_global_properties();
const auto &wso = get_witness_schedule_object();

if (has_hardfork(STEEMIT_HARDFORK_0_16__551)) {
/**
* At block 7,000,000 have a 9.5% instantaneous inflation rate, decreasing to 0.95% at a rate of 0.01%
* every 250k blocks. This narrowing will take approximately 20.5 years and will complete on block 220,750,000
*/
* Inflation rate starts from 15,15% and reduced to 0.95% at a rate of 0.01% every 250k blocks.
* At block 178,704,000 (16 years) have a 8.00% instantaneous inflation rate. This narrowing will take
* approximately 33 years and will complete on block 357,408,000.
*/
int64_t start_inflation_rate = int64_t(STEEMIT_INFLATION_RATE_START_PERCENT);
int64_t inflation_rate_adjustment = int64_t(
head_block_num() / STEEMIT_INFLATION_NARROWING_PERIOD);
int64_t inflation_rate_adjustment = int64_t(head_block_num() / STEEMIT_INFLATION_NARROWING_PERIOD);
int64_t inflation_rate_floor = int64_t(STEEMIT_INFLATION_RATE_STOP_PERCENT);

// below subtraction cannot underflow int64_t because inflation_rate_adjustment is <2^32
int64_t current_inflation_rate = std::max(start_inflation_rate -
inflation_rate_adjustment, inflation_rate_floor);
int64_t current_inflation_rate =
std::max(start_inflation_rate - inflation_rate_adjustment,
inflation_rate_floor);

auto new_steem =
(props.virtual_supply.amount * current_inflation_rate) /
(int64_t(STEEMIT_100_PERCENT) *
int64_t(STEEMIT_BLOCKS_PER_YEAR));
(int64_t(STEEMIT_100_PERCENT) * int64_t(STEEMIT_BLOCKS_PER_YEAR));
auto content_reward =
(new_steem * STEEMIT_CONTENT_REWARD_PERCENT) /
STEEMIT_100_PERCENT; /// 75% to content creator
STEEMIT_100_PERCENT; /// 66.67% to content creator
auto vesting_reward =
(new_steem * STEEMIT_VESTING_FUND_PERCENT) /
STEEMIT_100_PERCENT; /// 15% to vesting fund
auto witness_reward = new_steem - content_reward -
vesting_reward; /// Remaining 10% to witness pay
STEEMIT_100_PERCENT; /// 26.67% to vesting fund
auto witness_reward = new_steem - content_reward - vesting_reward; /// Remaining 6.66% to witness pay

const auto &cwit = get_witness(props.current_witness);
witness_reward *= STEEMIT_MAX_WITNESSES;
Expand All @@ -2369,8 +2367,9 @@ namespace golos {
witness_reward *= wso.miner_weight;
} else if (cwit.schedule == witness_object::top19) {
witness_reward *= wso.top19_weight;
} else
} else {
wlog("Encountered unknown witness type for witness: ${w}", ("w", cwit.owner));
}

witness_reward /= wso.witness_pay_normalization_factor;

Expand All @@ -2388,8 +2387,7 @@ namespace golos {
auto content_reward = get_content_reward();
auto curate_reward = get_curation_reward();
auto witness_pay = get_producer_reward();
auto vesting_reward =
content_reward + curate_reward + witness_pay;
auto vesting_reward = content_reward + curate_reward + witness_pay;

content_reward = content_reward + curate_reward;

Expand All @@ -2402,10 +2400,8 @@ namespace golos {
modify(props, [&](dynamic_global_property_object &p) {
p.total_vesting_fund_steem += vesting_reward;
p.total_reward_fund_steem += content_reward;
p.current_supply +=
content_reward + witness_pay + vesting_reward;
p.virtual_supply +=
content_reward + witness_pay + vesting_reward;
p.current_supply += content_reward + witness_pay + vesting_reward;
p.virtual_supply += content_reward + witness_pay + vesting_reward;
});
}
}
Expand Down

0 comments on commit 362b88f

Please sign in to comment.