Redirect operation fee to dividend
This commit is contained in:
parent
5860002d0a
commit
c729b247ed
3 changed files with 22 additions and 0 deletions
|
|
@ -128,6 +128,19 @@ database& generic_evaluator::db()const { return trx_state->db(); }
|
||||||
db().adjust_balance(fee_payer, fee_from_account);
|
db().adjust_balance(fee_payer, fee_from_account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void generic_evaluator::pay_fee_to_dividend()
|
||||||
|
{
|
||||||
|
const database& d = db();
|
||||||
|
|
||||||
|
if(d.head_block_time() > HARDFORK_FEES_AS_DIVIDENDS_TIME) {
|
||||||
|
const asset_object& ao = (*fee_asset).get_id()(d);
|
||||||
|
const asset_dividend_data_object& core_asset_dividend_data_obj = (*ao.dividend_data_id)(d);
|
||||||
|
fc::optional<account_id_type> rake_account_id = core_asset_dividend_data_obj.dividend_distribution_account;
|
||||||
|
db_adjust_balance(*rake_account_id, fee_from_account);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
object_id_type generic_evaluator::get_relative_id( object_id_type rel_id )const
|
object_id_type generic_evaluator::get_relative_id( object_id_type rel_id )const
|
||||||
{
|
{
|
||||||
if (!is_relative(rel_id))
|
if (!is_relative(rel_id))
|
||||||
|
|
|
||||||
7
libraries/chain/hardfork.d/FEES_AS_DIVIDENDS.hf
Normal file
7
libraries/chain/hardfork.d/FEES_AS_DIVIDENDS.hf
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef HARDFORK_FEES_AS_DIVIDENDS_TIME
|
||||||
|
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||||
|
#define HARDFORK_FEES_AS_DIVIDENDS_TIME (fc::time_point_sec::from_iso_string("2022-02-20T00:00:00"))
|
||||||
|
#else
|
||||||
|
#define HARDFORK_FEES_AS_DIVIDENDS_TIME (fc::time_point_sec::from_iso_string("2022-02-20T00:00:00"))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
@ -107,6 +107,7 @@ namespace graphene { namespace chain {
|
||||||
// cause a circular dependency
|
// cause a circular dependency
|
||||||
share_type calculate_fee_for_operation(const operation& op) const;
|
share_type calculate_fee_for_operation(const operation& op) const;
|
||||||
void db_adjust_balance(const account_id_type& fee_payer, asset fee_from_account);
|
void db_adjust_balance(const account_id_type& fee_payer, asset fee_from_account);
|
||||||
|
void pay_fee_to_dividend();
|
||||||
|
|
||||||
asset fee_from_account;
|
asset fee_from_account;
|
||||||
share_type core_fee_paid;
|
share_type core_fee_paid;
|
||||||
|
|
@ -170,6 +171,7 @@ namespace graphene { namespace chain {
|
||||||
auto result = eval->do_apply(op);
|
auto result = eval->do_apply(op);
|
||||||
|
|
||||||
db_adjust_balance(op.fee_payer(), -fee_from_account);
|
db_adjust_balance(op.fee_payer(), -fee_from_account);
|
||||||
|
pay_fee_to_dividend();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue