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

Commit

Permalink
Merge pull request #939 from GolosChain/295-chain-propertie
Browse files Browse the repository at this point in the history
Fix naming in chain_properties_19 #295
  • Loading branch information
afalaleev authored Aug 24, 2018
2 parents 6b19a3c + c76d3f1 commit 0d44ab9
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion libraries/api/chain_api_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/api/include/golos/api/chain_api_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace golos { namespace api {

fc::optional<uint16_t> max_referral_interest_rate;
fc::optional<uint32_t> max_referral_term_sec;
fc::optional<asset> referral_break_fee;
fc::optional<asset> max_referral_break_fee;
};

} } // golos::api
Expand All @@ -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))
2 changes: 1 addition & 1 deletion libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 12 additions & 6 deletions libraries/protocol/include/golos/protocol/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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))

Expand Down
6 changes: 3 additions & 3 deletions libraries/protocol/steem_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions libraries/wallet/include/golos/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace golos { namespace wallet {

fc::optional<uint16_t> max_referral_interest_rate;
fc::optional<uint32_t> max_referral_term_sec;
fc::optional<asset> referral_break_fee;
fc::optional<asset> max_referral_break_fee;
};

struct optional_private_box_query {
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0d44ab9

Please sign in to comment.