Skip to content

Commit

Permalink
Merge pull request steemit#3415 from steemit/3410-PR
Browse files Browse the repository at this point in the history
Fix sbd print rate
  • Loading branch information
Michael Vandeberg authored Jul 24, 2019
2 parents 777e991 + d3d1510 commit ae7a39c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
16 changes: 12 additions & 4 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2864,7 +2864,6 @@ void database::init_genesis( uint64_t init_supply, uint64_t sbd_init_supply )
p.reverse_auction_seconds = STEEM_REVERSE_AUCTION_WINDOW_SECONDS_HF6;
p.sbd_stop_percent = STEEM_SBD_STOP_PERCENT_HF14;
p.sbd_start_percent = STEEM_SBD_START_PERCENT_HF14;
p.sbd_stop_adjust = 0;
p.next_maintenance_time = STEEM_GENESIS_TIME;
p.last_budget_time = STEEM_GENESIS_TIME;
} );
Expand Down Expand Up @@ -3898,12 +3897,22 @@ void database::update_virtual_supply()

if( !median_price.is_null() && has_hardfork( STEEM_HARDFORK_0_14__230 ) )
{
auto percent_sbd = uint16_t( ( ( fc::uint128_t( ( dgp.current_sbd_supply * get_feed_history().current_median_history ).amount.value ) * STEEM_100_PERCENT )
uint16_t percent_sbd = 0;

if( has_hardfork( STEEM_HARDFORK_0_21 ) )
{
percent_sbd = uint16_t( ( ( fc::uint128_t( ( dgp.current_sbd_supply * get_feed_history().current_median_history ).amount.value ) * STEEM_100_PERCENT + dgp.virtual_supply.amount.value/2 )
/ dgp.virtual_supply.amount.value ).to_uint64() );
}
else
{
percent_sbd = uint16_t( ( ( fc::uint128_t( ( dgp.current_sbd_supply * get_feed_history().current_median_history ).amount.value ) * STEEM_100_PERCENT )
/ dgp.virtual_supply.amount.value ).to_uint64() );
}

if( percent_sbd <= dgp.sbd_start_percent )
dgp.sbd_print_rate = STEEM_100_PERCENT;
else if( percent_sbd >= dgp.sbd_stop_percent - dgp.sbd_stop_adjust )
else if( percent_sbd >= dgp.sbd_stop_percent )
dgp.sbd_print_rate = 0;
else
dgp.sbd_print_rate = ( ( dgp.sbd_stop_percent - percent_sbd ) * STEEM_100_PERCENT ) / ( dgp.sbd_stop_percent - dgp.sbd_start_percent );
Expand Down Expand Up @@ -5187,7 +5196,6 @@ void database::apply_hardfork( uint32_t hardfork )
{
modify( get_dynamic_global_properties(), [&]( dynamic_global_property_object& gpo )
{
gpo.sbd_stop_adjust = STEEM_SBD_STOP_ADJUST;
gpo.sps_fund_percent = STEEM_PROPOSAL_FUND_PERCENT_HF21;
gpo.content_reward_percent = STEEM_CONTENT_REWARD_PERCENT_HF21;
gpo.downvote_pool_percent = STEEM_DOWNVOTE_POOL_PERCENT_HF21;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ namespace steem { namespace chain {

uint16_t sbd_stop_percent = 0;
uint16_t sbd_start_percent = 0;
uint16_t sbd_stop_adjust = 0;

//settings used to compute payments for every proposal
time_point_sec next_maintenance_time;
Expand Down Expand Up @@ -206,7 +205,6 @@ FC_REFLECT( steem::chain::dynamic_global_property_object,
(available_account_subsidies)
(sbd_stop_percent)
(sbd_start_percent)
(sbd_stop_adjust)
(next_maintenance_time)
(last_budget_time)
(content_reward_percent)
Expand Down
1 change: 0 additions & 1 deletion libraries/protocol/get_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ fc::variant_object get_config()
result["STEEM_SBD_START_PERCENT_HF20"] = STEEM_SBD_START_PERCENT_HF20;
result["STEEM_SBD_STOP_PERCENT_HF14"] = STEEM_SBD_STOP_PERCENT_HF14;
result["STEEM_SBD_STOP_PERCENT_HF20"] = STEEM_SBD_STOP_PERCENT_HF20;
result["STEEM_SBD_STOP_ADJUST"] = STEEM_SBD_STOP_ADJUST;
result["STEEM_SECOND_CASHOUT_WINDOW"] = STEEM_SECOND_CASHOUT_WINDOW;
result["STEEM_SOFT_MAX_COMMENT_DEPTH"] = STEEM_SOFT_MAX_COMMENT_DEPTH;
result["STEEM_START_MINER_VOTING_BLOCK"] = STEEM_START_MINER_VOTING_BLOCK;
Expand Down
1 change: 0 additions & 1 deletion libraries/protocol/include/steem/protocol/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@
#define STEEM_SBD_STOP_PERCENT_HF20 (10*STEEM_1_PERCENT ) // Stop printing SBD at 10% Market Cap
#define STEEM_SBD_START_PERCENT_HF14 (2*STEEM_1_PERCENT) // Start reducing printing of SBD at 2% Market Cap
#define STEEM_SBD_START_PERCENT_HF20 (9*STEEM_1_PERCENT) // Start reducing printing of SBD at 9% Market Cap
#define STEEM_SBD_STOP_ADJUST 5 // Make a small adjustment to the stop percent to stop at the debt limit (see issue 3184)

#define STEEM_MIN_ACCOUNT_NAME_LENGTH 3
#define STEEM_MAX_ACCOUNT_NAME_LENGTH 16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
"STEEM_SBD_START_PERCENT_HF20": 900,
"STEEM_SBD_STOP_PERCENT_HF14": 500,
"STEEM_SBD_STOP_PERCENT_HF20": 1000,
"STEEM_SBD_STOP_ADJUST": 5,
"STEEM_SECONDS_PER_YEAR": 31536000,
"STEEM_SECOND_CASHOUT_WINDOW": 259200,
"STEEM_SOFT_MAX_BLOCK_SIZE": 2097152,
Expand Down

0 comments on commit ae7a39c

Please sign in to comment.