BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
graphene::chain::generic_evaluator Class Referenceabstract

#include <evaluator.hpp>

Inheritance diagram for graphene::chain::generic_evaluator:
graphene::chain::evaluator< account_create_evaluator > graphene::chain::evaluator< account_update_evaluator > graphene::chain::evaluator< account_upgrade_evaluator > graphene::chain::evaluator< account_whitelist_evaluator > graphene::chain::evaluator< assert_evaluator > graphene::chain::evaluator< asset_claim_fees_evaluator > graphene::chain::evaluator< asset_claim_pool_evaluator > graphene::chain::evaluator< asset_create_evaluator > graphene::chain::evaluator< asset_fund_fee_pool_evaluator > graphene::chain::evaluator< asset_global_settle_evaluator > graphene::chain::evaluator< asset_issue_evaluator > graphene::chain::evaluator< asset_publish_feeds_evaluator > graphene::chain::evaluator< asset_reserve_evaluator > graphene::chain::evaluator< asset_settle_evaluator > graphene::chain::evaluator< asset_update_bitasset_evaluator > graphene::chain::evaluator< asset_update_evaluator > graphene::chain::evaluator< asset_update_feed_producers_evaluator > graphene::chain::evaluator< asset_update_issuer_evaluator > graphene::chain::evaluator< balance_claim_evaluator > graphene::chain::evaluator< bid_collateral_evaluator > graphene::chain::evaluator< blind_transfer_evaluator > graphene::chain::evaluator< call_order_update_evaluator > graphene::chain::evaluator< committee_member_create_evaluator > graphene::chain::evaluator< committee_member_update_evaluator > graphene::chain::evaluator< committee_member_update_global_parameters_evaluator > graphene::chain::evaluator< credit_deal_repay_evaluator > graphene::chain::evaluator< credit_deal_update_evaluator > graphene::chain::evaluator< credit_offer_accept_evaluator > graphene::chain::evaluator< credit_offer_create_evaluator > graphene::chain::evaluator< credit_offer_delete_evaluator > graphene::chain::evaluator< credit_offer_update_evaluator > graphene::chain::evaluator< custom_authority_create_evaluator > graphene::chain::evaluator< custom_authority_delete_evaluator > graphene::chain::evaluator< custom_authority_update_evaluator > graphene::chain::evaluator< custom_evaluator > graphene::chain::evaluator< htlc_create_evaluator > graphene::chain::evaluator< htlc_extend_evaluator > graphene::chain::evaluator< htlc_redeem_evaluator > graphene::chain::evaluator< limit_order_cancel_evaluator > graphene::chain::evaluator< limit_order_create_evaluator > graphene::chain::evaluator< limit_order_update_evaluator > graphene::chain::evaluator< liquidity_pool_create_evaluator > graphene::chain::evaluator< liquidity_pool_delete_evaluator > graphene::chain::evaluator< liquidity_pool_deposit_evaluator > graphene::chain::evaluator< liquidity_pool_exchange_evaluator > graphene::chain::evaluator< liquidity_pool_update_evaluator > graphene::chain::evaluator< liquidity_pool_withdraw_evaluator > graphene::chain::evaluator< override_transfer_evaluator > graphene::chain::evaluator< proposal_create_evaluator > graphene::chain::evaluator< proposal_delete_evaluator > graphene::chain::evaluator< proposal_update_evaluator > graphene::chain::evaluator< samet_fund_borrow_evaluator > graphene::chain::evaluator< samet_fund_create_evaluator > graphene::chain::evaluator< samet_fund_delete_evaluator > graphene::chain::evaluator< samet_fund_repay_evaluator > graphene::chain::evaluator< samet_fund_update_evaluator > graphene::chain::evaluator< ticket_create_evaluator > graphene::chain::evaluator< ticket_update_evaluator > graphene::chain::evaluator< transfer_evaluator > graphene::chain::evaluator< transfer_from_blind_evaluator > graphene::chain::evaluator< transfer_to_blind_evaluator > graphene::chain::evaluator< vesting_balance_create_evaluator > graphene::chain::evaluator< vesting_balance_withdraw_evaluator > graphene::chain::evaluator< withdraw_permission_claim_evaluator > graphene::chain::evaluator< withdraw_permission_create_evaluator > graphene::chain::evaluator< withdraw_permission_delete_evaluator > graphene::chain::evaluator< withdraw_permission_update_evaluator > graphene::chain::evaluator< witness_create_evaluator > graphene::chain::evaluator< witness_update_evaluator > graphene::chain::evaluator< worker_create_evaluator > graphene::chain::evaluator< DerivedEvaluator >

Public Member Functions

virtual ~generic_evaluator ()
 
virtual int get_type () const =0
 
virtual operation_result start_evaluate (transaction_evaluation_state &eval_state, const operation &op, bool apply)
 
virtual operation_result evaluate (const operation &op)=0
 
virtual operation_result apply (const operation &op)=0
 
virtual void pay_fee ()
 
databasedb () const
 

Protected Member Functions

void prepare_fee (account_id_type account_id, asset fee)
 Fetch objects relevant to fee payer and set pointer members. More...
 
virtual void convert_fee ()
 
object_id_type get_relative_id (object_id_type rel_id) const
 
void pay_fba_fee (uint64_t fba_id)
 
share_type calculate_fee_for_operation (const operation &op) const
 
void db_adjust_balance (const account_id_type &fee_payer, asset fee_from_account)
 

Protected Attributes

asset fee_from_account
 
share_type core_fee_paid
 
const account_objectfee_paying_account = nullptr
 
const account_statistics_objectfee_paying_account_statistics = nullptr
 
const asset_objectfee_asset = nullptr
 
const asset_dynamic_data_objectfee_asset_dyn_data = nullptr
 
transaction_evaluation_statetrx_state
 

Detailed Description

Definition at line 39 of file evaluator.hpp.

Constructor & Destructor Documentation

◆ ~generic_evaluator()

virtual graphene::chain::generic_evaluator::~generic_evaluator ( )
inlinevirtual

Definition at line 42 of file evaluator.hpp.

Member Function Documentation

◆ apply()

virtual operation_result graphene::chain::generic_evaluator::apply ( const operation op)
pure virtual

Implemented in graphene::chain::evaluator< DerivedEvaluator >, graphene::chain::evaluator< asset_create_evaluator >, graphene::chain::evaluator< balance_claim_evaluator >, graphene::chain::evaluator< assert_evaluator >, graphene::chain::evaluator< htlc_create_evaluator >, graphene::chain::evaluator< samet_fund_create_evaluator >, graphene::chain::evaluator< account_whitelist_evaluator >, graphene::chain::evaluator< custom_authority_create_evaluator >, graphene::chain::evaluator< account_update_evaluator >, graphene::chain::evaluator< blind_transfer_evaluator >, graphene::chain::evaluator< samet_fund_delete_evaluator >, graphene::chain::evaluator< limit_order_create_evaluator >, graphene::chain::evaluator< account_create_evaluator >, graphene::chain::evaluator< limit_order_cancel_evaluator >, graphene::chain::evaluator< custom_authority_delete_evaluator >, graphene::chain::evaluator< asset_claim_fees_evaluator >, graphene::chain::evaluator< asset_update_issuer_evaluator >, graphene::chain::evaluator< liquidity_pool_withdraw_evaluator >, graphene::chain::evaluator< asset_publish_feeds_evaluator >, graphene::chain::evaluator< withdraw_permission_create_evaluator >, graphene::chain::evaluator< credit_offer_update_evaluator >, graphene::chain::evaluator< account_upgrade_evaluator >, graphene::chain::evaluator< proposal_delete_evaluator >, graphene::chain::evaluator< htlc_redeem_evaluator >, graphene::chain::evaluator< withdraw_permission_update_evaluator >, graphene::chain::evaluator< asset_global_settle_evaluator >, graphene::chain::evaluator< asset_settle_evaluator >, graphene::chain::evaluator< override_transfer_evaluator >, graphene::chain::evaluator< vesting_balance_create_evaluator >, graphene::chain::evaluator< transfer_to_blind_evaluator >, graphene::chain::evaluator< committee_member_update_global_parameters_evaluator >, graphene::chain::evaluator< asset_fund_fee_pool_evaluator >, graphene::chain::evaluator< samet_fund_update_evaluator >, graphene::chain::evaluator< transfer_evaluator >, graphene::chain::evaluator< asset_claim_pool_evaluator >, graphene::chain::evaluator< asset_reserve_evaluator >, graphene::chain::evaluator< withdraw_permission_delete_evaluator >, graphene::chain::evaluator< ticket_create_evaluator >, graphene::chain::evaluator< ticket_update_evaluator >, graphene::chain::evaluator< worker_create_evaluator >, graphene::chain::evaluator< samet_fund_repay_evaluator >, graphene::chain::evaluator< credit_deal_repay_evaluator >, graphene::chain::evaluator< proposal_update_evaluator >, graphene::chain::evaluator< asset_update_evaluator >, graphene::chain::evaluator< credit_deal_update_evaluator >, graphene::chain::evaluator< witness_update_evaluator >, graphene::chain::evaluator< transfer_from_blind_evaluator >, graphene::chain::evaluator< vesting_balance_withdraw_evaluator >, graphene::chain::evaluator< limit_order_update_evaluator >, graphene::chain::evaluator< liquidity_pool_deposit_evaluator >, graphene::chain::evaluator< liquidity_pool_exchange_evaluator >, graphene::chain::evaluator< credit_offer_delete_evaluator >, graphene::chain::evaluator< custom_authority_update_evaluator >, graphene::chain::evaluator< samet_fund_borrow_evaluator >, graphene::chain::evaluator< htlc_extend_evaluator >, graphene::chain::evaluator< credit_offer_accept_evaluator >, graphene::chain::evaluator< custom_evaluator >, graphene::chain::evaluator< witness_create_evaluator >, graphene::chain::evaluator< credit_offer_create_evaluator >, graphene::chain::evaluator< liquidity_pool_create_evaluator >, graphene::chain::evaluator< call_order_update_evaluator >, graphene::chain::evaluator< asset_update_bitasset_evaluator >, graphene::chain::evaluator< liquidity_pool_delete_evaluator >, graphene::chain::evaluator< bid_collateral_evaluator >, graphene::chain::evaluator< withdraw_permission_claim_evaluator >, graphene::chain::evaluator< proposal_create_evaluator >, graphene::chain::evaluator< committee_member_create_evaluator >, graphene::chain::evaluator< asset_update_feed_producers_evaluator >, graphene::chain::evaluator< asset_issue_evaluator >, graphene::chain::evaluator< liquidity_pool_update_evaluator >, and graphene::chain::evaluator< committee_member_update_evaluator >.

◆ calculate_fee_for_operation()

share_type graphene::chain::generic_evaluator::calculate_fee_for_operation ( const operation op) const
protected

Definition at line 115 of file evaluator.cpp.

◆ convert_fee()

void graphene::chain::generic_evaluator::convert_fee ( )
protectedvirtual

Convert the fee into BTS through the exchange pool.

Reads core_fee_paid field for how much CORE is deducted from the exchange pool, and fee_from_account for how much USD is added to the pool.

Since prepare_fee() does the validation checks ensuring the account and fee pool have sufficient balance and the exchange rate is correct, those validation checks are not replicated here.

Rather than returning a value, this method fills in core_fee_paid field.

Reimplemented in graphene::chain::limit_order_update_evaluator, and graphene::chain::limit_order_create_evaluator.

Definition at line 80 of file evaluator.cpp.

◆ db()

database & graphene::chain::generic_evaluator::db ( ) const

Definition at line 39 of file evaluator.cpp.

◆ db_adjust_balance()

void graphene::chain::generic_evaluator::db_adjust_balance ( const account_id_type &  fee_payer,
asset  fee_from_account 
)
protected

Definition at line 119 of file evaluator.cpp.

◆ evaluate()

virtual operation_result graphene::chain::generic_evaluator::evaluate ( const operation op)
pure virtual
Note
derived classes should ASSUME that the default validation that is indepenent of chain state should be performed by op.validate() and should not perform these extra checks.

Implemented in graphene::chain::evaluator< DerivedEvaluator >, graphene::chain::evaluator< asset_create_evaluator >, graphene::chain::evaluator< balance_claim_evaluator >, graphene::chain::evaluator< assert_evaluator >, graphene::chain::evaluator< htlc_create_evaluator >, graphene::chain::evaluator< samet_fund_create_evaluator >, graphene::chain::evaluator< account_whitelist_evaluator >, graphene::chain::evaluator< custom_authority_create_evaluator >, graphene::chain::evaluator< account_update_evaluator >, graphene::chain::evaluator< blind_transfer_evaluator >, graphene::chain::evaluator< samet_fund_delete_evaluator >, graphene::chain::evaluator< limit_order_create_evaluator >, graphene::chain::evaluator< account_create_evaluator >, graphene::chain::evaluator< limit_order_cancel_evaluator >, graphene::chain::evaluator< custom_authority_delete_evaluator >, graphene::chain::evaluator< asset_claim_fees_evaluator >, graphene::chain::evaluator< asset_update_issuer_evaluator >, graphene::chain::evaluator< liquidity_pool_withdraw_evaluator >, graphene::chain::evaluator< asset_publish_feeds_evaluator >, graphene::chain::evaluator< withdraw_permission_create_evaluator >, graphene::chain::evaluator< credit_offer_update_evaluator >, graphene::chain::evaluator< account_upgrade_evaluator >, graphene::chain::evaluator< proposal_delete_evaluator >, graphene::chain::evaluator< htlc_redeem_evaluator >, graphene::chain::evaluator< withdraw_permission_update_evaluator >, graphene::chain::evaluator< asset_global_settle_evaluator >, graphene::chain::evaluator< asset_settle_evaluator >, graphene::chain::evaluator< override_transfer_evaluator >, graphene::chain::evaluator< vesting_balance_create_evaluator >, graphene::chain::evaluator< transfer_to_blind_evaluator >, graphene::chain::evaluator< committee_member_update_global_parameters_evaluator >, graphene::chain::evaluator< asset_fund_fee_pool_evaluator >, graphene::chain::evaluator< samet_fund_update_evaluator >, graphene::chain::evaluator< transfer_evaluator >, graphene::chain::evaluator< asset_claim_pool_evaluator >, graphene::chain::evaluator< asset_reserve_evaluator >, graphene::chain::evaluator< withdraw_permission_delete_evaluator >, graphene::chain::evaluator< ticket_create_evaluator >, graphene::chain::evaluator< ticket_update_evaluator >, graphene::chain::evaluator< worker_create_evaluator >, graphene::chain::evaluator< samet_fund_repay_evaluator >, graphene::chain::evaluator< credit_deal_repay_evaluator >, graphene::chain::evaluator< proposal_update_evaluator >, graphene::chain::evaluator< asset_update_evaluator >, graphene::chain::evaluator< credit_deal_update_evaluator >, graphene::chain::evaluator< witness_update_evaluator >, graphene::chain::evaluator< transfer_from_blind_evaluator >, graphene::chain::evaluator< vesting_balance_withdraw_evaluator >, graphene::chain::evaluator< limit_order_update_evaluator >, graphene::chain::evaluator< liquidity_pool_deposit_evaluator >, graphene::chain::evaluator< liquidity_pool_exchange_evaluator >, graphene::chain::evaluator< credit_offer_delete_evaluator >, graphene::chain::evaluator< custom_authority_update_evaluator >, graphene::chain::evaluator< samet_fund_borrow_evaluator >, graphene::chain::evaluator< htlc_extend_evaluator >, graphene::chain::evaluator< credit_offer_accept_evaluator >, graphene::chain::evaluator< custom_evaluator >, graphene::chain::evaluator< witness_create_evaluator >, graphene::chain::evaluator< credit_offer_create_evaluator >, graphene::chain::evaluator< liquidity_pool_create_evaluator >, graphene::chain::evaluator< call_order_update_evaluator >, graphene::chain::evaluator< asset_update_bitasset_evaluator >, graphene::chain::evaluator< liquidity_pool_delete_evaluator >, graphene::chain::evaluator< bid_collateral_evaluator >, graphene::chain::evaluator< withdraw_permission_claim_evaluator >, graphene::chain::evaluator< proposal_create_evaluator >, graphene::chain::evaluator< committee_member_create_evaluator >, graphene::chain::evaluator< asset_update_feed_producers_evaluator >, graphene::chain::evaluator< asset_issue_evaluator >, graphene::chain::evaluator< liquidity_pool_update_evaluator >, and graphene::chain::evaluator< committee_member_update_evaluator >.

◆ get_relative_id()

object_id_type graphene::chain::generic_evaluator::get_relative_id ( object_id_type  rel_id) const
protected

◆ get_type()

virtual int graphene::chain::generic_evaluator::get_type ( ) const
pure virtual

◆ pay_fba_fee()

void graphene::chain::generic_evaluator::pay_fba_fee ( uint64_t  fba_id)
protected

pay_fee() for FBA subclass should simply call this method

Definition at line 100 of file evaluator.cpp.

◆ pay_fee()

void graphene::chain::generic_evaluator::pay_fee ( )
virtual

Routes the fee to where it needs to go. The default implementation routes the fee to the account_statistics_object of the fee_paying_account.

Before pay_fee() is called, the fee is computed by prepare_fee() and has been moved out of the fee_paying_account and (if paid in a non-CORE asset) converted by the asset's fee pool.

Therefore, when pay_fee() is called, the fee only exists in this->core_fee_paid. So pay_fee() need only increment the receiving balance.

The default implementation simply calls account_statistics_object->pay_fee() to increment pending_fees or pending_vested_fees.

Reimplemented in graphene::chain::limit_order_update_evaluator, graphene::chain::blind_transfer_evaluator, graphene::chain::limit_order_create_evaluator, graphene::chain::transfer_from_blind_evaluator, graphene::chain::asset_create_evaluator, and graphene::chain::transfer_to_blind_evaluator.

Definition at line 91 of file evaluator.cpp.

◆ prepare_fee()

void graphene::chain::generic_evaluator::prepare_fee ( account_id_type  account_id,
asset  fee 
)
protected

Fetch objects relevant to fee payer and set pointer members.

Parameters
account_idAccount which is paying the fee
feeThe fee being paid. May be in assets other than core.

This method verifies that the fee is valid and sets the object pointer members and the fee fields. It should be called during do_evaluate.

In particular, core_fee_paid field is set by prepare_fee().

Definition at line 51 of file evaluator.cpp.

◆ start_evaluate()

operation_result graphene::chain::generic_evaluator::start_evaluate ( transaction_evaluation_state eval_state,
const operation op,
bool  apply 
)
virtual

Definition at line 41 of file evaluator.cpp.

Member Data Documentation

◆ core_fee_paid

share_type graphene::chain::generic_evaluator::core_fee_paid
protected

Definition at line 115 of file evaluator.hpp.

◆ fee_asset

const asset_object* graphene::chain::generic_evaluator::fee_asset = nullptr
protected

Definition at line 118 of file evaluator.hpp.

◆ fee_asset_dyn_data

const asset_dynamic_data_object* graphene::chain::generic_evaluator::fee_asset_dyn_data = nullptr
protected

Definition at line 119 of file evaluator.hpp.

◆ fee_from_account

asset graphene::chain::generic_evaluator::fee_from_account
protected

Definition at line 114 of file evaluator.hpp.

◆ fee_paying_account

const account_object* graphene::chain::generic_evaluator::fee_paying_account = nullptr
protected

Definition at line 116 of file evaluator.hpp.

◆ fee_paying_account_statistics

const account_statistics_object* graphene::chain::generic_evaluator::fee_paying_account_statistics = nullptr
protected

Definition at line 117 of file evaluator.hpp.

◆ trx_state

transaction_evaluation_state* graphene::chain::generic_evaluator::trx_state
protected

Definition at line 120 of file evaluator.hpp.


The documentation for this class was generated from the following files: