From 517ea70c95c72501d6c8505bec787dac966a88d7 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Fri, 17 Jul 2015 22:07:07 -0400 Subject: [PATCH] #169 - Removing Bulk Discounts --- libraries/chain/account_object.cpp | 30 ------------------- .../include/graphene/chain/account_object.hpp | 2 -- .../chain/protocol/chain_parameters.hpp | 9 ------ 3 files changed, 41 deletions(-) diff --git a/libraries/chain/account_object.cpp b/libraries/chain/account_object.cpp index 79c4060a..387ad917 100644 --- a/libraries/chain/account_object.cpp +++ b/libraries/chain/account_object.cpp @@ -50,25 +50,6 @@ void account_balance_object::adjust_balance(const asset& delta) balance += delta.amount; } -uint16_t account_statistics_object::calculate_bulk_discount_percent(const chain_parameters& params) const -{ - uint64_t bulk_discount_percent = 0; - if( lifetime_fees_paid >= params.bulk_discount_threshold_max ) - bulk_discount_percent = params.max_bulk_discount_percent_of_fee; - else if(params.bulk_discount_threshold_max.value != - params.bulk_discount_threshold_min.value) - { - bulk_discount_percent = - (params.max_bulk_discount_percent_of_fee * - (lifetime_fees_paid.value - - params.bulk_discount_threshold_min.value)) / - (params.bulk_discount_threshold_max.value - - params.bulk_discount_threshold_min.value); - } - assert( bulk_discount_percent <= GRAPHENE_100_PERCENT ); - - return bulk_discount_percent; -} void account_statistics_object::process_fees(const account_object& a, database& d) const { @@ -117,17 +98,6 @@ void account_statistics_object::process_fees(const account_object& a, database& share_type vested_fee_subtotal(pending_vested_fees); share_type vesting_cashback, vested_cashback; - if( lifetime_fees_paid > props.parameters.bulk_discount_threshold_min && - a.is_member(d.head_block_time()) ) - { - auto bulk_discount_rate = calculate_bulk_discount_percent(props.parameters); - vesting_cashback = cut_fee(vesting_fee_subtotal, bulk_discount_rate); - vesting_fee_subtotal -= vesting_cashback; - - vested_cashback = cut_fee(vested_fee_subtotal, bulk_discount_rate); - vested_fee_subtotal -= vested_cashback; - } - pay_out_fees(a, vesting_fee_subtotal, true); d.deposit_cashback(a, vesting_cashback, true); pay_out_fees(a, vested_fee_subtotal, false); diff --git a/libraries/chain/include/graphene/chain/account_object.hpp b/libraries/chain/include/graphene/chain/account_object.hpp index 56e3f96a..f8f1d08e 100644 --- a/libraries/chain/include/graphene/chain/account_object.hpp +++ b/libraries/chain/include/graphene/chain/account_object.hpp @@ -74,8 +74,6 @@ namespace graphene { namespace chain { */ share_type pending_vested_fees; - /// @brief Calculate the percentage discount this user receives on his fees - uint16_t calculate_bulk_discount_percent(const chain_parameters& params)const; /// @brief Split up and pay out @ref pending_fees and @ref pending_vested_fees void process_fees(const account_object& a, database& d) const; }; diff --git a/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp b/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp index fd82537f..1d76f52f 100644 --- a/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp +++ b/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp @@ -52,9 +52,6 @@ namespace graphene { namespace chain { uint16_t lifetime_referrer_percent_of_fee = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE; ///< percent of transaction fees paid to network uint32_t cashback_vesting_period_seconds = GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC; ///< time after cashback rewards are accrued before they become liquid share_type cashback_vesting_threshold = GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD; ///< the maximum cashback that can be received without vesting - uint16_t max_bulk_discount_percent_of_fee = GRAPHENE_DEFAULT_MAX_BULK_DISCOUNT_PERCENT; ///< the maximum percentage discount for bulk discounts - share_type bulk_discount_threshold_min = GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN; ///< the minimum amount of fees paid to qualify for bulk discounts - share_type bulk_discount_threshold_max = GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX; ///< the amount of fees paid to qualify for the max bulk discount percent bool count_non_member_votes = true; ///< set to false to restrict voting privlegages to member accounts bool allow_non_member_whitelists = false; ///< true if non-member accounts may set whitelists and blacklists; false otherwise share_type witness_pay_per_block = GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK; ///< CORE to be allocated to witnesses (per block) @@ -71,11 +68,8 @@ namespace graphene { namespace chain { { FC_ASSERT( reserve_percent_of_fee <= GRAPHENE_100_PERCENT ); FC_ASSERT( network_percent_of_fee <= GRAPHENE_100_PERCENT ); - FC_ASSERT( max_bulk_discount_percent_of_fee <= GRAPHENE_100_PERCENT ); FC_ASSERT( lifetime_referrer_percent_of_fee <= GRAPHENE_100_PERCENT ); FC_ASSERT( network_percent_of_fee + lifetime_referrer_percent_of_fee <= GRAPHENE_100_PERCENT ); - FC_ASSERT( bulk_discount_threshold_min <= bulk_discount_threshold_max ); - FC_ASSERT( bulk_discount_threshold_min > 0 ); FC_ASSERT( block_interval >= GRAPHENE_MIN_BLOCK_INTERVAL ); FC_ASSERT( block_interval <= GRAPHENE_MAX_BLOCK_INTERVAL ); @@ -115,11 +109,8 @@ FC_REFLECT( graphene::chain::chain_parameters, (reserve_percent_of_fee) (network_percent_of_fee) (lifetime_referrer_percent_of_fee) - (max_bulk_discount_percent_of_fee) (cashback_vesting_period_seconds) (cashback_vesting_threshold) - (bulk_discount_threshold_min) - (bulk_discount_threshold_max) (count_non_member_votes) (allow_non_member_whitelists) (witness_pay_per_block)