#169 - Removing Bulk Discounts

This commit is contained in:
Daniel Larimer 2015-07-17 22:07:07 -04:00
parent c67acc0cf5
commit 517ea70c95
3 changed files with 0 additions and 41 deletions

View file

@ -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);

View file

@ -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;
};

View file

@ -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)