From c76d3f1f4c42ec54a6cf450e577adc095ff48459 Mon Sep 17 00:00:00 2001 From: maslenitsa93 Date: Thu, 23 Aug 2018 12:40:25 +0300 Subject: [PATCH] Fix naming in chain_properties_19 #295 --- libraries/api/chain_api_properties.cpp | 2 +- .../include/golos/api/chain_api_properties.hpp | 4 ++-- libraries/chain/database.cpp | 2 +- .../protocol/include/golos/protocol/config.hpp | 18 ++++++++++++------ .../golos/protocol/steem_operations.hpp | 9 ++++----- libraries/protocol/steem_operations.cpp | 6 +++--- .../wallet/include/golos/wallet/wallet.hpp | 4 ++-- libraries/wallet/wallet.cpp | 4 ++-- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/libraries/api/chain_api_properties.cpp b/libraries/api/chain_api_properties.cpp index b426385f70..74c85d0d8a 100644 --- a/libraries/api/chain_api_properties.cpp +++ b/libraries/api/chain_api_properties.cpp @@ -18,7 +18,7 @@ namespace golos { namespace api { if (db.has_hardfork(STEEMIT_HARDFORK_0_19)) { max_referral_interest_rate = src.max_referral_interest_rate; max_referral_term_sec = src.max_referral_term_sec; - referral_break_fee = src.referral_break_fee; + max_referral_break_fee = src.max_referral_break_fee; } } diff --git a/libraries/api/include/golos/api/chain_api_properties.hpp b/libraries/api/include/golos/api/chain_api_properties.hpp index 916b180509..401c86a856 100644 --- a/libraries/api/include/golos/api/chain_api_properties.hpp +++ b/libraries/api/include/golos/api/chain_api_properties.hpp @@ -23,7 +23,7 @@ namespace golos { namespace api { fc::optional max_referral_interest_rate; fc::optional max_referral_term_sec; - fc::optional referral_break_fee; + fc::optional max_referral_break_fee; }; } } // golos::api @@ -33,4 +33,4 @@ FC_REFLECT( (account_creation_fee)(maximum_block_size)(sbd_interest_rate) (create_account_min_golos_fee)(create_account_min_delegation) (create_account_delegation_time)(min_delegation) - (max_referral_interest_rate)(max_referral_term_sec)(referral_break_fee)) + (max_referral_interest_rate)(max_referral_term_sec)(max_referral_break_fee)) diff --git a/libraries/chain/database.cpp b/libraries/chain/database.cpp index 752d301f5a..a21002c292 100644 --- a/libraries/chain/database.cpp +++ b/libraries/chain/database.cpp @@ -1897,7 +1897,7 @@ namespace golos { namespace chain { calc_median(&chain_properties_18::min_delegation); calc_median(&chain_properties_19::max_referral_interest_rate); calc_median(&chain_properties_19::max_referral_term_sec); - calc_median(&chain_properties_19::referral_break_fee); + calc_median(&chain_properties_19::max_referral_break_fee); modify(wso, [&](witness_schedule_object &_wso) { _wso.median_props = median_props; diff --git a/libraries/protocol/include/golos/protocol/config.hpp b/libraries/protocol/include/golos/protocol/config.hpp index b2096fbd38..4efb17976d 100644 --- a/libraries/protocol/include/golos/protocol/config.hpp +++ b/libraries/protocol/include/golos/protocol/config.hpp @@ -112,9 +112,12 @@ #define GOLOS_CREATE_ACCOUNT_DELEGATION_TIME (fc::days(1)) #define GOLOS_MIN_DELEGATION_MULTIPLIER 10 -#define GOLOS_DEFAULT_MAX_REFERRAL_INTEREST_RATE (10*STEEMIT_1_PERCENT) // 10% -#define GOLOS_DEFAULT_MAX_REFERRAL_TERM_SEC (60*60*24*30*6) -#define GOLOS_DEFAULT_REFERRAL_BREAK_FEE (10*STEEMIT_MIN_ACCOUNT_CREATION_FEE) +#define GOLOS_DEFAULT_REFERRAL_INTEREST_RATE (10*STEEMIT_1_PERCENT) // 10% +#define GOLOS_MAX_REFERRAL_INTEREST_RATE STEEMIT_100_PERCENT +#define GOLOS_DEFAULT_REFERRAL_TERM_SEC (60*60*24*30*6) +#define GOLOS_MAX_REFERRAL_TERM_SEC (60*60*24*30*12) +#define GOLOS_DEFAULT_REFERRAL_BREAK_FEE asset(100, STEEM_SYMBOL) +#define GOLOS_MAX_REFERRAL_BREAK_FEE asset(100, STEEM_SYMBOL) #define STEEMIT_MINING_REWARD asset(666, STEEM_SYMBOL) #define STEEMIT_MINING_REWARD_PRE_HF_16 asset(1000, STEEM_SYMBOL) @@ -325,9 +328,12 @@ #define GOLOS_CREATE_ACCOUNT_DELEGATION_TIME (fc::days(30)) #define GOLOS_MIN_DELEGATION_MULTIPLIER 10 -#define GOLOS_DEFAULT_MAX_REFERRAL_INTEREST_RATE (10*STEEMIT_1_PERCENT) // 10% -#define GOLOS_DEFAULT_MAX_REFERRAL_TERM_SEC (60*60*24*30*6) -#define GOLOS_DEFAULT_REFERRAL_BREAK_FEE (10*STEEMIT_MIN_ACCOUNT_CREATION_FEE) +#define GOLOS_DEFAULT_REFERRAL_INTEREST_RATE (10*STEEMIT_1_PERCENT) // 10% +#define GOLOS_MAX_REFERRAL_INTEREST_RATE STEEMIT_100_PERCENT +#define GOLOS_DEFAULT_REFERRAL_TERM_SEC (60*60*24*30*6) +#define GOLOS_MAX_REFERRAL_TERM_SEC (60*60*24*30*12) +#define GOLOS_DEFAULT_REFERRAL_BREAK_FEE asset(100, STEEM_SYMBOL) +#define GOLOS_MAX_REFERRAL_BREAK_FEE asset(100, STEEM_SYMBOL) #define STEEMIT_MINING_REWARD asset(666, STEEM_SYMBOL) #define STEEMIT_MINING_REWARD_PRE_HF_16 asset(1000, STEEM_SYMBOL) diff --git a/libraries/protocol/include/golos/protocol/steem_operations.hpp b/libraries/protocol/include/golos/protocol/steem_operations.hpp index d85c5eec83..8b5fd216fd 100644 --- a/libraries/protocol/include/golos/protocol/steem_operations.hpp +++ b/libraries/protocol/include/golos/protocol/steem_operations.hpp @@ -505,18 +505,17 @@ namespace golos { namespace protocol { /** * Maximum percent of referral deductions */ - uint16_t max_referral_interest_rate = GOLOS_DEFAULT_MAX_REFERRAL_INTEREST_RATE; + uint16_t max_referral_interest_rate = GOLOS_DEFAULT_REFERRAL_INTEREST_RATE; /** * Maximum term of referral deductions */ - uint32_t max_referral_term_sec = GOLOS_DEFAULT_MAX_REFERRAL_TERM_SEC; + uint32_t max_referral_term_sec = GOLOS_DEFAULT_REFERRAL_TERM_SEC; /** * Fee for breaking referral deductions by referral */ - asset referral_break_fee = - asset(GOLOS_DEFAULT_REFERRAL_BREAK_FEE, STEEM_SYMBOL); + asset max_referral_break_fee = GOLOS_DEFAULT_REFERRAL_BREAK_FEE; void validate() const; @@ -1179,7 +1178,7 @@ FC_REFLECT_DERIVED( (create_account_delegation_time)(min_delegation)) FC_REFLECT_DERIVED( (golos::protocol::chain_properties_19), ((golos::protocol::chain_properties_18)), - (max_referral_interest_rate)(max_referral_term_sec)(referral_break_fee)) + (max_referral_interest_rate)(max_referral_term_sec)(max_referral_break_fee)) FC_REFLECT_TYPENAME((golos::protocol::versioned_chain_properties)) diff --git a/libraries/protocol/steem_operations.cpp b/libraries/protocol/steem_operations.cpp index 0604319883..3c9b04acb4 100644 --- a/libraries/protocol/steem_operations.cpp +++ b/libraries/protocol/steem_operations.cpp @@ -228,9 +228,9 @@ namespace golos { namespace protocol { void chain_properties_19::validate() const { chain_properties_18::validate(); - GOLOS_CHECK_VALUE_LE(max_referral_interest_rate, STEEMIT_100_PERCENT); - GOLOS_CHECK_VALUE_LE(max_referral_term_sec, 60*60*24*30*12); - GOLOS_CHECK_VALUE_LEGE(referral_break_fee, 1*account_creation_fee, 10*account_creation_fee); + GOLOS_CHECK_VALUE_LE(max_referral_interest_rate, GOLOS_MAX_REFERRAL_INTEREST_RATE); + GOLOS_CHECK_VALUE_LE(max_referral_term_sec, GOLOS_MAX_REFERRAL_TERM_SEC); + GOLOS_CHECK_VALUE_LEGE(max_referral_break_fee.amount, 0, GOLOS_MAX_REFERRAL_BREAK_FEE.amount); } void witness_update_operation::validate() const { diff --git a/libraries/wallet/include/golos/wallet/wallet.hpp b/libraries/wallet/include/golos/wallet/wallet.hpp index 36d23ccc9c..0fe3175bb4 100644 --- a/libraries/wallet/include/golos/wallet/wallet.hpp +++ b/libraries/wallet/include/golos/wallet/wallet.hpp @@ -47,7 +47,7 @@ namespace golos { namespace wallet { fc::optional max_referral_interest_rate; fc::optional max_referral_term_sec; - fc::optional referral_break_fee; + fc::optional max_referral_break_fee; }; struct optional_private_box_query { @@ -1493,7 +1493,7 @@ FC_REFLECT((golos::wallet::optional_chain_props), (account_creation_fee)(maximum_block_size)(sbd_interest_rate) (create_account_min_golos_fee)(create_account_min_delegation) (create_account_delegation_time)(min_delegation) - (max_referral_interest_rate)(max_referral_term_sec)(referral_break_fee)) + (max_referral_interest_rate)(max_referral_term_sec)(max_referral_break_fee)) FC_REFLECT( (golos::wallet::message_body), diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index b26d9557f8..86814be00a 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -329,7 +329,7 @@ namespace golos { namespace wallet { if (hf >= hardfork_version(0, STEEMIT_HARDFORK_0_19)) { result["max_referral_interest_rate"] = median_props.max_referral_interest_rate; result["max_referral_term_sec"] = median_props.max_referral_term_sec; - result["referral_break_fee"] = median_props.referral_break_fee; + result["max_referral_break_fee"] = median_props.max_referral_break_fee; } return result; @@ -2193,7 +2193,7 @@ fc::ecc::private_key wallet_api::derive_private_key(const std::string& prefix_st SET_PROP(min_delegation); SET_PROP(max_referral_interest_rate); SET_PROP(max_referral_term_sec); - SET_PROP(referral_break_fee); + SET_PROP(max_referral_break_fee); #undef SET_PROP op.owner = witness_account_name;