Minor evaluator cleanup
This commit is contained in:
parent
e662180981
commit
1e62c749af
20 changed files with 133 additions and 133 deletions
|
|
@ -113,7 +113,7 @@ object_id_type account_create_evaluator::do_apply( const account_create_operatio
|
|||
|
||||
|
||||
void_result account_update_evaluator::do_evaluate( const account_update_operation& o )
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
const auto& chain_params = db().get_global_properties().parameters;
|
||||
|
|
@ -152,9 +152,10 @@ void_result account_update_evaluator::do_evaluate( const account_update_operatio
|
|||
}
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result account_update_evaluator::do_apply( const account_update_operation& o )
|
||||
{
|
||||
{ try {
|
||||
db().modify( *acnt, [&](account_object& a){
|
||||
if( o.owner ) a.owner = resolve_relative_ids(*o.owner);
|
||||
if( o.active ) a.active = resolve_relative_ids(*o.active);
|
||||
|
|
@ -165,7 +166,7 @@ void_result account_update_evaluator::do_apply( const account_update_operation&
|
|||
}
|
||||
});
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result account_whitelist_evaluator::do_evaluate(const account_whitelist_operation& o)
|
||||
{ try {
|
||||
|
|
@ -179,7 +180,7 @@ void_result account_whitelist_evaluator::do_evaluate(const account_whitelist_ope
|
|||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result account_whitelist_evaluator::do_apply(const account_whitelist_operation& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
d.modify(*listed_account, [&o](account_object& a) {
|
||||
|
|
@ -194,20 +195,20 @@ void_result account_whitelist_evaluator::do_apply(const account_whitelist_operat
|
|||
});
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result account_upgrade_evaluator::do_evaluate(const account_upgrade_evaluator::operation_type& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
account = &d.get(o.account_to_upgrade);
|
||||
FC_ASSERT(!account->is_lifetime_member());
|
||||
|
||||
return {};
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result account_upgrade_evaluator::do_apply(const account_upgrade_evaluator::operation_type& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
d.modify(*account, [&](account_object& a) {
|
||||
|
|
@ -232,6 +233,6 @@ void_result account_upgrade_evaluator::do_apply(const account_upgrade_evaluator:
|
|||
});
|
||||
|
||||
return {};
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ struct predicate_evaluator
|
|||
};
|
||||
|
||||
void_result assert_evaluator::do_evaluate( const assert_operation& o )
|
||||
{
|
||||
{ try {
|
||||
const database& _db = db();
|
||||
uint32_t skip = _db.get_node_properties().skip_flags;
|
||||
auto max_predicate_opcode = _db.get_global_properties().parameters.max_predicate_opcode;
|
||||
|
|
@ -63,12 +63,12 @@ void_result assert_evaluator::do_evaluate( const assert_operation& o )
|
|||
FC_ASSERT( p.visit( predicate_evaluator( _db ) ) );
|
||||
}
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result assert_evaluator::do_apply( const assert_operation& o )
|
||||
{
|
||||
{ try {
|
||||
// assert_operation is always a no-op
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <functional>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
object_id_type asset_create_evaluator::do_evaluate( const asset_create_operation& op )
|
||||
void_result asset_create_evaluator::do_evaluate( const asset_create_operation& op )
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
|
|
@ -59,11 +59,11 @@ object_id_type asset_create_evaluator::do_evaluate( const asset_create_operation
|
|||
op.bitasset_options->force_settlement_delay_sec > chain_parameters.block_interval );
|
||||
}
|
||||
|
||||
return object_id_type();
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
object_id_type asset_create_evaluator::do_apply( const asset_create_operation& op )
|
||||
{
|
||||
{ try {
|
||||
const asset_dynamic_data_object& dyn_asset =
|
||||
db().create<asset_dynamic_data_object>( [&]( asset_dynamic_data_object& a ) {
|
||||
a.current_supply = 0;
|
||||
|
|
@ -95,8 +95,8 @@ object_id_type asset_create_evaluator::do_apply( const asset_create_operation& o
|
|||
});
|
||||
assert( new_asset.id == next_asset_id );
|
||||
|
||||
return next_asset_id;
|
||||
}
|
||||
return new_asset.id;
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result asset_issue_evaluator::do_evaluate( const asset_issue_operation& o )
|
||||
{ try {
|
||||
|
|
@ -120,7 +120,7 @@ void_result asset_issue_evaluator::do_evaluate( const asset_issue_operation& o )
|
|||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_issue_evaluator::do_apply( const asset_issue_operation& o )
|
||||
{
|
||||
{ try {
|
||||
db().adjust_balance( o.issue_to_account, o.asset_to_issue );
|
||||
|
||||
db().modify( *asset_dyn_data, [&]( asset_dynamic_data_object& data ){
|
||||
|
|
@ -128,7 +128,7 @@ 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 )
|
||||
{ try {
|
||||
|
|
@ -151,7 +151,7 @@ void_result asset_burn_evaluator::do_evaluate( const asset_burn_operation& o )
|
|||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_burn_evaluator::do_apply( const asset_burn_operation& o )
|
||||
{
|
||||
{ try {
|
||||
db().adjust_balance( o.payer, -o.amount_to_burn );
|
||||
|
||||
db().modify( *asset_dyn_data, [&]( asset_dynamic_data_object& data ){
|
||||
|
|
@ -159,7 +159,7 @@ void_result asset_burn_evaluator::do_apply( const asset_burn_operation& o )
|
|||
});
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_fund_fee_pool_evaluator::do_evaluate(const asset_fund_fee_pool_operation& o)
|
||||
{ try {
|
||||
|
|
@ -173,7 +173,7 @@ void_result asset_fund_fee_pool_evaluator::do_evaluate(const asset_fund_fee_pool
|
|||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_fund_fee_pool_evaluator::do_apply(const asset_fund_fee_pool_operation& o)
|
||||
{
|
||||
{ try {
|
||||
db().adjust_balance(o.from_account, -o.amount);
|
||||
|
||||
db().modify( *asset_dyn_data, [&]( asset_dynamic_data_object& data ) {
|
||||
|
|
@ -181,7 +181,7 @@ void_result asset_fund_fee_pool_evaluator::do_apply(const asset_fund_fee_pool_op
|
|||
});
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_update_evaluator::do_evaluate(const asset_update_operation& o)
|
||||
{ try {
|
||||
|
|
@ -214,7 +214,7 @@ void_result asset_update_evaluator::do_evaluate(const asset_update_operation& o)
|
|||
} FC_CAPTURE_AND_RETHROW((o)) }
|
||||
|
||||
void_result asset_update_evaluator::do_apply(const asset_update_operation& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
// If we are now disabling force settlements, cancel all open force settlement orders
|
||||
|
|
@ -236,10 +236,10 @@ void_result asset_update_evaluator::do_apply(const asset_update_operation& o)
|
|||
});
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_update_bitasset_evaluator::do_evaluate(const asset_update_bitasset_operation& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
const asset_object& a = o.asset_to_update(d);
|
||||
|
|
@ -258,19 +258,19 @@ void_result asset_update_bitasset_evaluator::do_evaluate(const asset_update_bita
|
|||
FC_ASSERT( o.issuer == a.issuer, "", ("o.issuer", o.issuer)("a.issuer", a.issuer) );
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_update_bitasset_evaluator::do_apply(const asset_update_bitasset_operation& o)
|
||||
{
|
||||
{ try {
|
||||
db().modify(*bitasset_to_update, [&o](asset_bitasset_data_object& b) {
|
||||
b.options = o.new_options;
|
||||
});
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_update_feed_producers_evaluator::do_evaluate(const asset_update_feed_producers_evaluator::operation_type& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
FC_ASSERT( o.new_feed_producers.size() <= d.get_global_properties().parameters.maximum_asset_feed_publishers );
|
||||
|
|
@ -286,10 +286,10 @@ void_result asset_update_feed_producers_evaluator::do_evaluate(const asset_updat
|
|||
bitasset_to_update = &b;
|
||||
FC_ASSERT( a.issuer == o.issuer );
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_update_feed_producers_evaluator::do_apply(const asset_update_feed_producers_evaluator::operation_type& o)
|
||||
{
|
||||
{ try {
|
||||
db().modify(*bitasset_to_update, [&](asset_bitasset_data_object& a) {
|
||||
//This is tricky because I have a set of publishers coming in, but a map of publisher to feed is stored.
|
||||
//I need to update the map such that the keys match the new publishers, but not munge the old price feeds from
|
||||
|
|
@ -311,11 +311,10 @@ void_result asset_update_feed_producers_evaluator::do_apply(const asset_update_f
|
|||
|
||||
|
||||
return void_result();
|
||||
}
|
||||
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result asset_global_settle_evaluator::do_evaluate(const asset_global_settle_evaluator::operation_type& op)
|
||||
{
|
||||
{ try {
|
||||
const database& d = db();
|
||||
asset_to_settle = &op.asset_to_settle(d);
|
||||
FC_ASSERT(asset_to_settle->is_market_issued());
|
||||
|
|
@ -332,31 +331,31 @@ void_result asset_global_settle_evaluator::do_evaluate(const asset_global_settle
|
|||
"Cannot force settle at supplied price: least collateralized short lacks sufficient collateral to settle.");
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result asset_global_settle_evaluator::do_apply(const asset_global_settle_evaluator::operation_type& op)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
d.globally_settle_asset( op.asset_to_settle(db()), op.settle_price );
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
object_id_type asset_settle_evaluator::do_evaluate(const asset_settle_evaluator::operation_type& op)
|
||||
{
|
||||
void_result asset_settle_evaluator::do_evaluate(const asset_settle_evaluator::operation_type& op)
|
||||
{ try {
|
||||
const database& d = db();
|
||||
asset_to_settle = &op.amount.asset_id(d);
|
||||
FC_ASSERT(asset_to_settle->is_market_issued());
|
||||
const auto& bitasset = asset_to_settle->bitasset_data(d);
|
||||
FC_ASSERT(asset_to_settle->can_force_settle() || bitasset.has_settlement() );
|
||||
if( bitasset.is_prediction_market )
|
||||
if( bitasset.is_prediction_market )
|
||||
FC_ASSERT( bitasset.has_settlement(), "global settlement must occur before force settling a prediction market" );
|
||||
FC_ASSERT(d.get_balance(d.get(op.account), *asset_to_settle) >= op.amount);
|
||||
|
||||
return d.get_index_type<force_settlement_index>().get_next_id();
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
operation_result asset_settle_evaluator::do_apply(const asset_settle_evaluator::operation_type& op)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
d.adjust_balance(op.account, -op.amount);
|
||||
|
||||
|
|
@ -388,7 +387,7 @@ operation_result asset_settle_evaluator::do_apply(const asset_settle_evaluator::
|
|||
s.settlement_date = d.head_block_time() + asset_to_settle->bitasset_data(d).options.force_settlement_delay_sec;
|
||||
}).id;
|
||||
}
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result asset_publish_feeds_evaluator::do_evaluate(const asset_publish_feed_operation& o)
|
||||
{ try {
|
||||
|
|
@ -430,6 +429,6 @@ void_result asset_publish_feeds_evaluator::do_apply(const asset_publish_feed_ope
|
|||
db().check_call_orders( base );
|
||||
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW((o)) }
|
||||
} FC_CAPTURE_AND_RETHROW((o)) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -22,14 +22,15 @@
|
|||
#include <graphene/chain/account_object.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
object_id_type delegate_create_evaluator::do_evaluate( const delegate_create_operation& op )
|
||||
{
|
||||
|
||||
void_result delegate_create_evaluator::do_evaluate( const delegate_create_operation& op )
|
||||
{ try {
|
||||
FC_ASSERT(db().get(op.delegate_account).is_lifetime_member());
|
||||
return object_id_type();
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
object_id_type delegate_create_evaluator::do_apply( const delegate_create_operation& op )
|
||||
{
|
||||
{ try {
|
||||
vote_id_type vote_id;
|
||||
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
|
||||
vote_id = p.get_next_vote_id(vote_id_type::committee);
|
||||
|
|
@ -40,6 +41,6 @@ object_id_type delegate_create_evaluator::do_apply( const delegate_create_operat
|
|||
obj.vote_id = vote_id;
|
||||
});
|
||||
return new_del_object.id;
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@
|
|||
namespace graphene { namespace chain {
|
||||
|
||||
void_result global_parameters_update_evaluator::do_evaluate(const global_parameters_update_operation& o)
|
||||
{
|
||||
{ try {
|
||||
FC_ASSERT(trx_state->_is_proposed_trx);
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result global_parameters_update_evaluator::do_apply(const global_parameters_update_operation& o)
|
||||
{
|
||||
{ try {
|
||||
db().modify(db().get_global_properties(), [&o](global_property_object& p) {
|
||||
p.pending_parameters = o.new_parameters;
|
||||
});
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef asset_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const asset_create_operation& o );
|
||||
void_result do_evaluate( const asset_create_operation& o );
|
||||
object_id_type do_apply( const asset_create_operation& o );
|
||||
};
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef asset_settle_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate(const operation_type& op);
|
||||
void_result do_evaluate(const operation_type& op);
|
||||
operation_result do_apply(const operation_type& op);
|
||||
|
||||
const asset_object* asset_to_settle = nullptr;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef delegate_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const delegate_create_operation& o );
|
||||
void_result do_evaluate( const delegate_create_operation& o );
|
||||
object_id_type do_apply( const delegate_create_operation& o );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef limit_order_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const limit_order_create_operation& o );
|
||||
void_result do_evaluate( const limit_order_create_operation& o );
|
||||
object_id_type do_apply( const limit_order_create_operation& o );
|
||||
|
||||
asset calculate_market_fee( const asset_object* aobj, const asset& trade_amount );
|
||||
|
|
@ -43,7 +43,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef limit_order_cancel_operation operation_type;
|
||||
|
||||
asset do_evaluate( const limit_order_cancel_operation& o );
|
||||
void_result do_evaluate( const limit_order_cancel_operation& o );
|
||||
asset do_apply( const limit_order_cancel_operation& o );
|
||||
|
||||
const limit_order_object* _order;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef proposal_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const proposal_create_operation& o );
|
||||
void_result do_evaluate( const proposal_create_operation& o );
|
||||
object_id_type do_apply( const proposal_create_operation& o );
|
||||
|
||||
transaction _proposed_trx;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class vesting_balance_create_evaluator : public evaluator<vesting_balance_create
|
|||
public:
|
||||
typedef vesting_balance_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const vesting_balance_create_operation& op );
|
||||
void_result do_evaluate( const vesting_balance_create_operation& op );
|
||||
object_id_type do_apply( const vesting_balance_create_operation& op );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class withdraw_permission_create_evaluator : public evaluator<withdraw_permissio
|
|||
public:
|
||||
typedef withdraw_permission_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const operation_type& op );
|
||||
void_result do_evaluate( const operation_type& op );
|
||||
object_id_type do_apply( const operation_type& op );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef witness_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const witness_create_operation& o );
|
||||
void_result do_evaluate( const witness_create_operation& o );
|
||||
object_id_type do_apply( const witness_create_operation& o );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace graphene { namespace chain {
|
|||
public:
|
||||
typedef worker_create_operation operation_type;
|
||||
|
||||
object_id_type do_evaluate( const operation_type& o );
|
||||
void_result do_evaluate( const operation_type& o );
|
||||
object_id_type do_apply( const operation_type& o );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
#include <fc/uint128.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
object_id_type limit_order_create_evaluator::do_evaluate( const limit_order_create_operation& op )
|
||||
{
|
||||
void_result limit_order_create_evaluator::do_evaluate( const limit_order_create_operation& op )
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
FC_ASSERT( op.expiration >= d.head_block_time() );
|
||||
|
|
@ -42,13 +42,11 @@ object_id_type limit_order_create_evaluator::do_evaluate( const limit_order_crea
|
|||
FC_ASSERT( d.get_balance( _seller, _sell_asset ) >= op.amount_to_sell, "insufficient balance",
|
||||
("balance",d.get_balance(_seller,_sell_asset))("amount_to_sell",op.amount_to_sell) );
|
||||
|
||||
return object_id_type();
|
||||
}
|
||||
template<typename I>
|
||||
std::reverse_iterator<I> reverse( const I& itr ) { return std::reverse_iterator<I>(itr); }
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
object_id_type limit_order_create_evaluator::do_apply( const limit_order_create_operation& op )
|
||||
{
|
||||
{ try {
|
||||
const auto& seller_stats = _seller->statistics(db());
|
||||
db().modify( seller_stats, [&]( account_statistics_object& bal ){
|
||||
if( op.amount_to_sell.asset_id == asset_id_type() )
|
||||
|
|
@ -120,23 +118,21 @@ object_id_type limit_order_create_evaluator::do_apply( const limit_order_create_
|
|||
FC_ASSERT( !op.fill_or_kill || db().find_object(result) == nullptr );
|
||||
|
||||
return result;
|
||||
} // limit_order_evaluator::do_apply
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
asset limit_order_cancel_evaluator::do_evaluate( const limit_order_cancel_operation& o )
|
||||
{
|
||||
database& d = db();
|
||||
void_result limit_order_cancel_evaluator::do_evaluate( const limit_order_cancel_operation& o )
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
_order = &o.order(d);
|
||||
FC_ASSERT( _order->seller == o.fee_paying_account );
|
||||
auto refunded = _order->amount_for_sale();
|
||||
//adjust_balance( fee_paying_account, &refunded.asset_id(d), refunded.amount );
|
||||
FC_ASSERT( _order->seller == o.fee_paying_account );
|
||||
|
||||
return refunded;
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
asset limit_order_cancel_evaluator::do_apply( const limit_order_cancel_operation& o )
|
||||
{
|
||||
database& d = db();
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
auto base_asset = _order->sell_price.base.asset_id;
|
||||
auto quote_asset = _order->sell_price.quote.asset_id;
|
||||
|
|
@ -150,5 +146,6 @@ asset limit_order_cancel_evaluator::do_apply( const limit_order_cancel_operation
|
|||
db().check_call_orders(quote_asset(d));
|
||||
|
||||
return refunded;
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
object_id_type proposal_create_evaluator::do_evaluate(const proposal_create_operation& o)
|
||||
{
|
||||
void_result proposal_create_evaluator::do_evaluate(const proposal_create_operation& o)
|
||||
{ try {
|
||||
const database& d = db();
|
||||
const auto& global_parameters = d.get_global_properties().parameters;
|
||||
|
||||
|
|
@ -47,11 +47,11 @@ object_id_type proposal_create_evaluator::do_evaluate(const proposal_create_oper
|
|||
_proposed_trx.operations.push_back(op.op);
|
||||
_proposed_trx.validate();
|
||||
|
||||
return object_id_type();
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
object_id_type proposal_create_evaluator::do_apply(const proposal_create_operation& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
const proposal_object& proposal = d.create<proposal_object>([&](proposal_object& proposal) {
|
||||
|
|
@ -71,10 +71,10 @@ object_id_type proposal_create_evaluator::do_apply(const proposal_create_operati
|
|||
});
|
||||
|
||||
return proposal.id;
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result proposal_update_evaluator::do_evaluate(const proposal_update_operation& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
_proposal = &o.proposal(d);
|
||||
|
|
@ -106,10 +106,10 @@ void_result proposal_update_evaluator::do_evaluate(const proposal_update_operati
|
|||
}
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result proposal_update_evaluator::do_apply(const proposal_update_operation& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
// Potential optimization: if _executed_proposal is true, we can skip the modify step and make push_proposal skip
|
||||
|
|
@ -147,10 +147,10 @@ void_result proposal_update_evaluator::do_apply(const proposal_update_operation&
|
|||
}
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result proposal_delete_evaluator::do_evaluate(const proposal_delete_operation& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
_proposal = &o.proposal(d);
|
||||
|
|
@ -162,13 +162,13 @@ void_result proposal_delete_evaluator::do_evaluate(const proposal_delete_operati
|
|||
("provided", o.fee_paying_account)("required", *required_approvals));
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result proposal_delete_evaluator::do_apply(const proposal_delete_operation&)
|
||||
{
|
||||
void_result proposal_delete_evaluator::do_apply(const proposal_delete_operation& o)
|
||||
{ try {
|
||||
db().remove(*_proposal);
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -51,5 +51,6 @@ void_result transfer_evaluator::do_apply( const transfer_operation& o )
|
|||
db().adjust_balance( o.from, -o.amount );
|
||||
db().adjust_balance( o.to, o.amount );
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (o) )}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
object_id_type vesting_balance_create_evaluator::do_evaluate( const vesting_balance_create_operation& op )
|
||||
{
|
||||
void_result vesting_balance_create_evaluator::do_evaluate( const vesting_balance_create_operation& op )
|
||||
{ try {
|
||||
const database& d = db();
|
||||
|
||||
const account_object& creator_account = op.creator( d );
|
||||
|
|
@ -36,14 +36,14 @@ object_id_type vesting_balance_create_evaluator::do_evaluate( const vesting_bala
|
|||
FC_ASSERT( d.get_balance( creator_account.id, op.amount.asset_id ) >= op.amount );
|
||||
FC_ASSERT( !op.amount.asset_id(d).is_transfer_restricted() );
|
||||
|
||||
return object_id_type();
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
struct init_policy_visitor
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
init_policy_visitor( vesting_policy& po,
|
||||
init_policy_visitor( vesting_policy& po,
|
||||
const share_type& begin_balance,
|
||||
const fc::time_point_sec& n ):p(po),init_balance(begin_balance),now(n){}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ struct init_policy_visitor
|
|||
};
|
||||
|
||||
object_id_type vesting_balance_create_evaluator::do_apply( const vesting_balance_create_operation& op )
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
const time_point_sec now = d.head_block_time();
|
||||
|
||||
|
|
@ -91,10 +91,10 @@ object_id_type vesting_balance_create_evaluator::do_apply( const vesting_balance
|
|||
|
||||
|
||||
return vbo.id;
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result vesting_balance_withdraw_evaluator::do_evaluate( const vesting_balance_withdraw_operation& op )
|
||||
{
|
||||
{ try {
|
||||
const database& d = db();
|
||||
const time_point_sec now = d.head_block_time();
|
||||
|
||||
|
|
@ -106,10 +106,10 @@ void_result vesting_balance_withdraw_evaluator::do_evaluate( const vesting_balan
|
|||
/* const account_object& owner_account = */ op.owner( d );
|
||||
// TODO: Check asset authorizations and withdrawals
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result vesting_balance_withdraw_evaluator::do_apply( const vesting_balance_withdraw_operation& op )
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
const time_point_sec now = d.head_block_time();
|
||||
|
||||
|
|
@ -128,6 +128,6 @@ void_result vesting_balance_withdraw_evaluator::do_apply( const vesting_balance_
|
|||
|
||||
// TODO: Check asset authorizations and withdrawals
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
object_id_type withdraw_permission_create_evaluator::do_evaluate(const operation_type& op)
|
||||
void_result withdraw_permission_create_evaluator::do_evaluate(const operation_type& op)
|
||||
{ try {
|
||||
database& d = db();
|
||||
FC_ASSERT(d.find_object(op.withdraw_from_account));
|
||||
|
|
@ -32,7 +32,7 @@ object_id_type withdraw_permission_create_evaluator::do_evaluate(const operation
|
|||
FC_ASSERT(op.period_start_time + op.periods_until_expiration * op.withdrawal_period_sec > d.head_block_time());
|
||||
FC_ASSERT(op.withdrawal_period_sec >= d.get_global_properties().parameters.block_interval);
|
||||
|
||||
return d.get_index_type<withdraw_permission_index>().get_next_id();
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
object_id_type withdraw_permission_create_evaluator::do_apply(const operation_type& op)
|
||||
|
|
@ -42,7 +42,7 @@ object_id_type withdraw_permission_create_evaluator::do_apply(const operation_ty
|
|||
p.authorized_account = op.authorized_account;
|
||||
p.withdrawal_limit = op.withdrawal_limit;
|
||||
p.withdrawal_period_sec = op.withdrawal_period_sec;
|
||||
p.expiration = op.period_start_time + op.periods_until_expiration * op.withdrawal_period_sec;
|
||||
p.expiration = op.period_start_time + op.periods_until_expiration * op.withdrawal_period_sec;
|
||||
p.period_start_time = op.period_start_time;
|
||||
}).id;
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
|
@ -133,9 +133,9 @@ void_result withdraw_permission_delete_evaluator::do_evaluate(const withdraw_per
|
|||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result withdraw_permission_delete_evaluator::do_apply(const withdraw_permission_delete_evaluator::operation_type& op)
|
||||
{
|
||||
{ try {
|
||||
db().remove(db().get(op.withdrawal_permission));
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -23,14 +23,15 @@
|
|||
#include <graphene/chain/database.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
object_id_type witness_create_evaluator::do_evaluate( const witness_create_operation& op )
|
||||
{
|
||||
|
||||
void_result witness_create_evaluator::do_evaluate( const witness_create_operation& op )
|
||||
{ try {
|
||||
FC_ASSERT(db().get(op.witness_account).is_lifetime_member());
|
||||
return object_id_type();
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
object_id_type witness_create_evaluator::do_apply( const witness_create_operation& op )
|
||||
{
|
||||
{ try {
|
||||
vote_id_type vote_id;
|
||||
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
|
||||
vote_id = p.get_next_vote_id(vote_id_type::witness);
|
||||
|
|
@ -43,10 +44,10 @@ object_id_type witness_create_evaluator::do_apply( const witness_create_operatio
|
|||
obj.next_secret = op.initial_secret;
|
||||
});
|
||||
return new_witness_object.id;
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result witness_withdraw_pay_evaluator::do_evaluate(const witness_withdraw_pay_evaluator::operation_type& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
witness = &d.get(o.from_witness);
|
||||
|
|
@ -56,10 +57,10 @@ void_result witness_withdraw_pay_evaluator::do_evaluate(const witness_withdraw_p
|
|||
to_account = &d.get(o.to_account);
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
void_result witness_withdraw_pay_evaluator::do_apply(const witness_withdraw_pay_evaluator::operation_type& o)
|
||||
{
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
d.adjust_balance(o.to_account, asset(o.amount));
|
||||
|
|
@ -69,6 +70,6 @@ void_result witness_withdraw_pay_evaluator::do_apply(const witness_withdraw_pay_
|
|||
});
|
||||
|
||||
return void_result();
|
||||
}
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
|
|
@ -22,15 +22,15 @@
|
|||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
object_id_type worker_create_evaluator::do_evaluate(const worker_create_evaluator::operation_type& o)
|
||||
void_result worker_create_evaluator::do_evaluate(const worker_create_evaluator::operation_type& o)
|
||||
{ try {
|
||||
database& d = db();
|
||||
|
||||
FC_ASSERT(d.get(o.owner).is_lifetime_member());
|
||||
FC_ASSERT(o.work_begin_date >= d.head_block_time());
|
||||
|
||||
return object_id_type();
|
||||
} FC_CAPTURE_AND_RETHROW((o)) }
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
object_id_type worker_create_evaluator::do_apply(const worker_create_evaluator::operation_type& o)
|
||||
{ try {
|
||||
|
|
@ -51,6 +51,6 @@ object_id_type worker_create_evaluator::do_apply(const worker_create_evaluator::
|
|||
w.worker.set_which(o.initializer.which());
|
||||
w.worker.visit(worker_initialize_visitor(w, o.initializer, d));
|
||||
}).id;
|
||||
} FC_CAPTURE_AND_RETHROW((o)) }
|
||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
|
|||
Loading…
Reference in a new issue