#108 Rename Burn to Reserve
This commit is contained in:
parent
683fb6fe32
commit
2257e5da6c
12 changed files with 52 additions and 52 deletions
|
|
@ -89,9 +89,9 @@ void account_statistics_object::process_fees(const account_object& a, database&
|
|||
assert( network_cut <= core_fee_total );
|
||||
|
||||
#ifndef NDEBUG
|
||||
share_type burned = cut_fee(network_cut, props.parameters.burn_percent_of_fee);
|
||||
share_type accumulated = network_cut - burned;
|
||||
assert( accumulated + burned == network_cut );
|
||||
share_type reserveed = cut_fee(network_cut, props.parameters.reserve_percent_of_fee);
|
||||
share_type accumulated = network_cut - reserveed;
|
||||
assert( accumulated + reserveed == network_cut );
|
||||
#endif
|
||||
share_type lifetime_cut = cut_fee(core_fee_total, account.lifetime_referrer_fee_percentage);
|
||||
share_type referral = core_fee_total - network_cut - lifetime_cut;
|
||||
|
|
@ -110,7 +110,7 @@ void account_statistics_object::process_fees(const account_object& a, database&
|
|||
d.deposit_cashback(d.get(account.referrer), referrer_cut, require_vesting);
|
||||
d.deposit_cashback(d.get(account.registrar), registrar_cut, require_vesting);
|
||||
|
||||
assert( referrer_cut + registrar_cut + accumulated + burned + lifetime_cut == core_fee_total );
|
||||
assert( referrer_cut + registrar_cut + accumulated + reserveed + lifetime_cut == core_fee_total );
|
||||
};
|
||||
|
||||
share_type vesting_fee_subtotal(pending_fees);
|
||||
|
|
|
|||
|
|
@ -139,11 +139,11 @@ void_result asset_issue_evaluator::do_apply( const asset_issue_operation& o )
|
|||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_burn_evaluator::do_evaluate( const asset_burn_operation& o )
|
||||
void_result asset_reserve_evaluator::do_evaluate( const asset_reserve_operation& o )
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
const asset_object& a = o.amount_to_burn.asset_id(d);
|
||||
const asset_object& a = o.amount_to_reserve.asset_id(d);
|
||||
FC_ASSERT( !a.is_market_issued() );
|
||||
|
||||
from_account = &o.payer(d);
|
||||
|
|
@ -154,17 +154,17 @@ void_result asset_burn_evaluator::do_evaluate( const asset_burn_operation& o )
|
|||
}
|
||||
|
||||
asset_dyn_data = &a.dynamic_asset_data_id(d);
|
||||
FC_ASSERT( (asset_dyn_data->current_supply - o.amount_to_burn.amount) >= 0 );
|
||||
FC_ASSERT( (asset_dyn_data->current_supply - o.amount_to_reserve.amount) >= 0 );
|
||||
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_burn_evaluator::do_apply( const asset_burn_operation& o )
|
||||
void_result asset_reserve_evaluator::do_apply( const asset_reserve_operation& o )
|
||||
{ try {
|
||||
db().adjust_balance( o.payer, -o.amount_to_burn );
|
||||
db().adjust_balance( o.payer, -o.amount_to_reserve );
|
||||
|
||||
db().modify( *asset_dyn_data, [&]( asset_dynamic_data_object& data ){
|
||||
data.current_supply -= o.amount_to_burn.amount;
|
||||
data.current_supply -= o.amount_to_reserve.amount;
|
||||
});
|
||||
|
||||
return void_result();
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void database::initialize_evaluators()
|
|||
register_evaluator<custom_evaluator>();
|
||||
register_evaluator<asset_create_evaluator>();
|
||||
register_evaluator<asset_issue_evaluator>();
|
||||
register_evaluator<asset_burn_evaluator>();
|
||||
register_evaluator<asset_reserve_evaluator>();
|
||||
register_evaluator<asset_update_evaluator>();
|
||||
register_evaluator<asset_update_bitasset_evaluator>();
|
||||
register_evaluator<asset_update_feed_producers_evaluator>();
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ namespace graphene { namespace chain {
|
|||
const account_object* to_account = nullptr;
|
||||
};
|
||||
|
||||
class asset_burn_evaluator : public evaluator<asset_burn_evaluator>
|
||||
class asset_reserve_evaluator : public evaluator<asset_reserve_evaluator>
|
||||
{
|
||||
public:
|
||||
typedef asset_burn_operation operation_type;
|
||||
void_result do_evaluate( const asset_burn_operation& o );
|
||||
void_result do_apply( const asset_burn_operation& o );
|
||||
typedef asset_reserve_operation operation_type;
|
||||
void_result do_evaluate( const asset_reserve_operation& o );
|
||||
void_result do_apply( const asset_reserve_operation& o );
|
||||
|
||||
const asset_dynamic_data_object* asset_dyn_data = nullptr;
|
||||
const account_object* from_account = nullptr;
|
||||
|
|
|
|||
|
|
@ -783,16 +783,16 @@ namespace graphene { namespace chain {
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief used to take an asset out of circulation
|
||||
* @brief used to take an asset out of circulation, returning to the issuer
|
||||
* @ingroup operations
|
||||
*
|
||||
* @note You cannot burn market-issued assets.
|
||||
*/
|
||||
struct asset_burn_operation
|
||||
struct asset_reserve_operation
|
||||
{
|
||||
asset fee;
|
||||
account_id_type payer;
|
||||
asset amount_to_burn;
|
||||
asset amount_to_reserve;
|
||||
|
||||
account_id_type fee_payer()const { return payer; }
|
||||
void get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const;
|
||||
|
|
@ -801,7 +801,7 @@ namespace graphene { namespace chain {
|
|||
void get_balance_delta(balance_accumulator& acc, const operation_result& result = asset())const
|
||||
{
|
||||
acc.adjust(fee_payer(), -fee);
|
||||
acc.adjust(fee_payer(), -amount_to_burn);
|
||||
acc.adjust(fee_payer(), -amount_to_reserve);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1398,7 +1398,7 @@ namespace graphene { namespace chain {
|
|||
asset_update_bitasset_operation,
|
||||
asset_update_feed_producers_operation,
|
||||
asset_issue_operation,
|
||||
asset_burn_operation,
|
||||
asset_reserve_operation,
|
||||
asset_fund_fee_pool_operation,
|
||||
asset_settle_operation,
|
||||
asset_global_settle_operation,
|
||||
|
|
@ -1620,8 +1620,8 @@ FC_REFLECT( graphene::chain::asset_settle_operation, (fee)(account)(amount) )
|
|||
FC_REFLECT( graphene::chain::asset_global_settle_operation, (fee)(issuer)(asset_to_settle)(settle_price) )
|
||||
FC_REFLECT( graphene::chain::asset_issue_operation,
|
||||
(fee)(issuer)(asset_to_issue)(issue_to_account)(memo) )
|
||||
FC_REFLECT( graphene::chain::asset_burn_operation,
|
||||
(fee)(payer)(amount_to_burn) )
|
||||
FC_REFLECT( graphene::chain::asset_reserve_operation,
|
||||
(fee)(payer)(amount_to_reserve) )
|
||||
|
||||
FC_REFLECT( graphene::chain::proposal_create_operation, (fee)(fee_paying_account)(expiration_time)
|
||||
(proposed_ops)(review_period_seconds) )
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ namespace graphene { namespace chain {
|
|||
uint64_t asset_create_fee = 5*UINT64_C(500000000); ///< about $35 for LTM, the cost to register the cheapest asset
|
||||
uint64_t asset_update_fee = 150000; ///< the cost to modify a registered asset
|
||||
uint64_t asset_issue_fee = 700000; ///< the cost to print a UIA and send it to an account
|
||||
uint64_t asset_burn_fee = 1500000; ///< the cost to burn an asset
|
||||
uint64_t asset_reserve_fee = 1500000; ///< the cost to return an asset to the reserve pool
|
||||
uint64_t asset_fund_fee_pool_fee = 150000; ///< the cost to add funds to an asset's fee pool
|
||||
uint64_t asset_settle_fee = 7000000; ///< the cost to trigger a forced settlement of a market-issued asset
|
||||
uint64_t asset_global_settle_fee = 140000000; ///< the cost to trigger a global forced settlement of a market asset
|
||||
|
|
@ -446,7 +446,7 @@ namespace graphene { namespace chain {
|
|||
uint16_t maximum_witness_count = GRAPHENE_DEFAULT_MAX_WITNESSES; ///< maximum number of active witnesses
|
||||
uint16_t maximum_committee_count = GRAPHENE_DEFAULT_MAX_COMMITTEE; ///< maximum number of active delegates
|
||||
uint16_t maximum_authority_membership = GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP; ///< largest number of keys/accounts an authority can have
|
||||
uint16_t burn_percent_of_fee = GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE; ///< the percentage of the network's allocation of a fee that is taken out of circulation
|
||||
uint16_t reserve_percent_of_fee = GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE; ///< the percentage of the network's allocation of a fee that is taken out of circulation
|
||||
uint16_t network_percent_of_fee = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE; ///< percent of transaction fees paid to network
|
||||
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
|
||||
|
|
@ -465,7 +465,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
void validate()const
|
||||
{
|
||||
FC_ASSERT( burn_percent_of_fee <= GRAPHENE_100_PERCENT );
|
||||
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 );
|
||||
|
|
@ -575,7 +575,7 @@ FC_REFLECT( graphene::chain::fee_schedule_type,
|
|||
(asset_create_fee)
|
||||
(asset_update_fee)
|
||||
(asset_issue_fee)
|
||||
(asset_burn_fee)
|
||||
(asset_reserve_fee)
|
||||
(asset_fund_fee_pool_fee)
|
||||
(asset_settle_fee)
|
||||
(data_fee)
|
||||
|
|
@ -608,7 +608,7 @@ FC_REFLECT( graphene::chain::chain_parameters,
|
|||
(maximum_asset_whitelist_authorities)
|
||||
(maximum_asset_feed_publishers)
|
||||
(maximum_authority_membership)
|
||||
(burn_percent_of_fee)
|
||||
(reserve_percent_of_fee)
|
||||
(network_percent_of_fee)
|
||||
(lifetime_referrer_percent_of_fee)
|
||||
(max_bulk_discount_percent_of_fee)
|
||||
|
|
|
|||
|
|
@ -343,21 +343,21 @@ share_type asset_update_operation::calculate_fee(const fee_schedule_type& k)cons
|
|||
return k.asset_update_fee + k.total_data_fee(new_options);
|
||||
}
|
||||
|
||||
void asset_burn_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
void asset_reserve_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
{
|
||||
active_auth_set.insert(payer);
|
||||
}
|
||||
|
||||
void asset_burn_operation::validate()const
|
||||
void asset_reserve_operation::validate()const
|
||||
{
|
||||
FC_ASSERT( fee.amount >= 0 );
|
||||
FC_ASSERT( amount_to_burn.amount.value <= GRAPHENE_MAX_SHARE_SUPPLY );
|
||||
FC_ASSERT( amount_to_burn.amount.value > 0 );
|
||||
FC_ASSERT( amount_to_reserve.amount.value <= GRAPHENE_MAX_SHARE_SUPPLY );
|
||||
FC_ASSERT( amount_to_reserve.amount.value > 0 );
|
||||
}
|
||||
|
||||
share_type asset_burn_operation::calculate_fee(const fee_schedule_type& k)const
|
||||
share_type asset_reserve_operation::calculate_fee(const fee_schedule_type& k)const
|
||||
{
|
||||
return k.asset_burn_fee;
|
||||
return k.asset_reserve_fee;
|
||||
}
|
||||
|
||||
void asset_issue_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ struct operation_get_impacted_accounts
|
|||
_impacted.insert( o.issue_to_account );
|
||||
}
|
||||
|
||||
void operator()( const asset_burn_operation& o )const { }
|
||||
void operator()( const asset_reserve_operation& o )const { }
|
||||
void operator()( const asset_global_settle_operation& o )const { }
|
||||
void operator()( const asset_settle_operation& o )const { }
|
||||
|
||||
|
|
|
|||
|
|
@ -731,7 +731,7 @@ class wallet_api
|
|||
* @param broadcast true to broadcast the transaction on the network
|
||||
* @returns the signed transaction burning the asset
|
||||
*/
|
||||
signed_transaction burn_asset(string from,
|
||||
signed_transaction reserve_asset(string from,
|
||||
string amount,
|
||||
string symbol,
|
||||
bool broadcast = false);
|
||||
|
|
@ -988,7 +988,7 @@ FC_API( graphene::wallet::wallet_api,
|
|||
(get_asset)
|
||||
(get_bitasset_data)
|
||||
(fund_asset_fee_pool)
|
||||
(burn_asset)
|
||||
(reserve_asset)
|
||||
(global_settle_asset)
|
||||
(settle_asset)
|
||||
(whitelist_account)
|
||||
|
|
|
|||
|
|
@ -1087,22 +1087,22 @@ public:
|
|||
return sign_transaction( tx, broadcast );
|
||||
} FC_CAPTURE_AND_RETHROW( (from)(symbol)(amount)(broadcast) ) }
|
||||
|
||||
signed_transaction burn_asset(string from,
|
||||
signed_transaction reserve_asset(string from,
|
||||
string amount,
|
||||
string symbol,
|
||||
bool broadcast /* = false */)
|
||||
{ try {
|
||||
account_object from_account = get_account(from);
|
||||
optional<asset_object> asset_to_burn = find_asset(symbol);
|
||||
if (!asset_to_burn)
|
||||
optional<asset_object> asset_to_reserve = find_asset(symbol);
|
||||
if (!asset_to_reserve)
|
||||
FC_THROW("No asset with that symbol exists!");
|
||||
|
||||
asset_burn_operation burn_op;
|
||||
burn_op.payer = from_account.id;
|
||||
burn_op.amount_to_burn = asset_to_burn->amount_from_string(amount);
|
||||
asset_reserve_operation reserve_op;
|
||||
reserve_op.payer = from_account.id;
|
||||
reserve_op.amount_to_reserve = asset_to_reserve->amount_from_string(amount);
|
||||
|
||||
signed_transaction tx;
|
||||
tx.operations.push_back( burn_op );
|
||||
tx.operations.push_back( reserve_op );
|
||||
tx.visit( operation_set_fee( _remote_db->get_global_properties().parameters.current_fees ) );
|
||||
tx.validate();
|
||||
|
||||
|
|
@ -2041,7 +2041,7 @@ signed_transaction wallet_api::fund_asset_fee_pool(string from,
|
|||
return my->fund_asset_fee_pool(from, symbol, amount, broadcast);
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::burn_asset(string from,
|
||||
signed_transaction wallet_api::reserve_asset(string from,
|
||||
string amount,
|
||||
string symbol,
|
||||
bool broadcast /* = false */)
|
||||
|
|
|
|||
|
|
@ -613,9 +613,9 @@ BOOST_AUTO_TEST_CASE( worker_pay_test )
|
|||
trx.clear();
|
||||
}
|
||||
{
|
||||
asset_burn_operation op;
|
||||
asset_reserve_operation op;
|
||||
op.payer = account_id_type();
|
||||
op.amount_to_burn = asset(GRAPHENE_MAX_SHARE_SUPPLY/2);
|
||||
op.amount_to_reserve = asset(GRAPHENE_MAX_SHARE_SUPPLY/2);
|
||||
trx.operations.push_back(op);
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
trx.clear();
|
||||
|
|
@ -726,9 +726,9 @@ BOOST_AUTO_TEST_CASE( refund_worker_test )
|
|||
trx.clear();
|
||||
}
|
||||
{
|
||||
asset_burn_operation op;
|
||||
asset_reserve_operation op;
|
||||
op.payer = account_id_type();
|
||||
op.amount_to_burn = asset(GRAPHENE_MAX_SHARE_SUPPLY/2);
|
||||
op.amount_to_reserve = asset(GRAPHENE_MAX_SHARE_SUPPLY/2);
|
||||
trx.operations.push_back(op);
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
trx.clear();
|
||||
|
|
@ -800,9 +800,9 @@ BOOST_AUTO_TEST_CASE( burn_worker_test )
|
|||
}
|
||||
{
|
||||
// refund some asset to fill up the pool
|
||||
asset_burn_operation op;
|
||||
asset_reserve_operation op;
|
||||
op.payer = account_id_type();
|
||||
op.amount_to_burn = asset(GRAPHENE_MAX_SHARE_SUPPLY/2);
|
||||
op.amount_to_reserve = asset(GRAPHENE_MAX_SHARE_SUPPLY/2);
|
||||
trx.operations.push_back(op);
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
trx.clear();
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE( transfer_whitelist_uia )
|
|||
trx.operations.back() = op;
|
||||
//Fail because nathan is blacklisted
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
trx.operations = {asset_burn_operation{asset(), nathan.id, advanced.amount(10)}};
|
||||
trx.operations = {asset_reserve_operation{asset(), nathan.id, advanced.amount(10)}};
|
||||
//Fail because nathan is blacklisted
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
std::swap(op.from, op.to);
|
||||
|
|
@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE( transfer_whitelist_uia )
|
|||
BOOST_CHECK(!nathan.is_authorized_asset(advanced));
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
|
||||
trx.operations = {asset_burn_operation{asset(), dan.id, advanced.amount(10)}};
|
||||
trx.operations = {asset_reserve_operation{asset(), dan.id, advanced.amount(10)}};
|
||||
PUSH_TX(db, trx, ~0);
|
||||
BOOST_CHECK_EQUAL(get_balance(dan, advanced), 40);
|
||||
} catch(fc::exception& e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue