diff --git a/libraries/app/impacted.cpp b/libraries/app/impacted.cpp index 17364ac2..e0de1d05 100644 --- a/libraries/app/impacted.cpp +++ b/libraries/app/impacted.cpp @@ -328,10 +328,10 @@ struct get_impacted_account_visitor void operator()( const son_wallet_deposit_process_operation& op ){ _impacted.insert( op.payer ); } - void operator()( const son_wallet_withdrawal_create_operation& op ){ + void operator()( const son_wallet_withdraw_create_operation& op ){ _impacted.insert( op.payer ); } - void operator()( const son_wallet_withdrawal_process_operation& op ){ + void operator()( const son_wallet_withdraw_process_operation& op ){ _impacted.insert( op.payer ); } void operator()( const sidechain_address_add_operation& op ){ diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 8ef21df6..85d5a91b 100755 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -119,7 +119,7 @@ add_library( graphene_chain son_wallet_evaluator.cpp son_wallet_deposit_evaluator.cpp - son_wallet_withdrawal_evaluator.cpp + son_wallet_withdraw_evaluator.cpp sidechain_address_evaluator.cpp diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index e2b5f099..0be37c42 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include @@ -84,7 +84,7 @@ #include #include #include -#include +#include #include #include @@ -262,8 +262,8 @@ void database::initialize_evaluators() register_evaluator(); register_evaluator(); register_evaluator(); - register_evaluator(); - register_evaluator(); + register_evaluator(); + register_evaluator(); register_evaluator(); register_evaluator(); register_evaluator(); @@ -313,7 +313,7 @@ void database::initialize_indexes() add_index< primary_index >(); add_index< primary_index >(); - add_index< primary_index >(); + add_index< primary_index >(); add_index< primary_index >(); diff --git a/libraries/chain/db_notify.cpp b/libraries/chain/db_notify.cpp index 798494ea..1b0b5158 100644 --- a/libraries/chain/db_notify.cpp +++ b/libraries/chain/db_notify.cpp @@ -315,10 +315,10 @@ struct get_impacted_account_visitor void operator()( const son_wallet_deposit_process_operation& op ) { _impacted.insert( op.payer ); } - void operator()( const son_wallet_withdrawal_create_operation& op ) { + void operator()( const son_wallet_withdraw_create_operation& op ) { _impacted.insert( op.payer ); } - void operator()( const son_wallet_withdrawal_process_operation& op ) { + void operator()( const son_wallet_withdraw_process_operation& op ) { _impacted.insert( op.payer ); } void operator()( const sidechain_address_add_operation& op ) { @@ -427,7 +427,7 @@ void get_relevant_accounts( const object* obj, flat_set& accoun break; } case son_wallet_deposit_object_type:{ break; - } case son_wallet_withdrawal_object_type:{ + } case son_wallet_withdraw_object_type:{ break; } case sidechain_address_object_type:{ const auto& aobj = dynamic_cast(obj); diff --git a/libraries/chain/include/graphene/chain/protocol/operations.hpp b/libraries/chain/include/graphene/chain/protocol/operations.hpp index be2bb68c..37eccf80 100644 --- a/libraries/chain/include/graphene/chain/protocol/operations.hpp +++ b/libraries/chain/include/graphene/chain/protocol/operations.hpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include namespace graphene { namespace chain { @@ -151,8 +151,8 @@ namespace graphene { namespace chain { son_wallet_update_operation, son_wallet_deposit_create_operation, son_wallet_deposit_process_operation, - son_wallet_withdrawal_create_operation, - son_wallet_withdrawal_process_operation, + son_wallet_withdraw_create_operation, + son_wallet_withdraw_process_operation, sidechain_address_add_operation, sidechain_address_update_operation, sidechain_address_delete_operation diff --git a/libraries/chain/include/graphene/chain/protocol/son_wallet_withdrawal.hpp b/libraries/chain/include/graphene/chain/protocol/son_wallet_withdraw.hpp similarity index 69% rename from libraries/chain/include/graphene/chain/protocol/son_wallet_withdrawal.hpp rename to libraries/chain/include/graphene/chain/protocol/son_wallet_withdraw.hpp index d68997b4..7aed5dde 100644 --- a/libraries/chain/include/graphene/chain/protocol/son_wallet_withdrawal.hpp +++ b/libraries/chain/include/graphene/chain/protocol/son_wallet_withdraw.hpp @@ -5,7 +5,7 @@ namespace graphene { namespace chain { - struct son_wallet_withdrawal_create_operation : public base_operation + struct son_wallet_withdraw_create_operation : public base_operation { struct fee_parameters_type { uint64_t fee = 0; }; @@ -28,14 +28,14 @@ namespace graphene { namespace chain { share_type calculate_fee(const fee_parameters_type& k)const { return 0; } }; - struct son_wallet_withdrawal_process_operation : public base_operation + struct son_wallet_withdraw_process_operation : public base_operation { struct fee_parameters_type { uint64_t fee = 0; }; asset fee; account_id_type payer; - son_wallet_withdrawal_id_type son_wallet_withdrawal_id; + son_wallet_withdraw_id_type son_wallet_withdraw_id; account_id_type fee_payer()const { return payer; } share_type calculate_fee(const fee_parameters_type& k)const { return 0; } @@ -43,9 +43,9 @@ namespace graphene { namespace chain { } } // namespace graphene::chain -FC_REFLECT(graphene::chain::son_wallet_withdrawal_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT(graphene::chain::son_wallet_withdrawal_create_operation, (fee)(payer) +FC_REFLECT(graphene::chain::son_wallet_withdraw_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT(graphene::chain::son_wallet_withdraw_create_operation, (fee)(payer) (timestamp) (sidechain) (sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount) (peerplays_from) (peerplays_to) (peerplays_asset)) -FC_REFLECT(graphene::chain::son_wallet_withdrawal_process_operation::fee_parameters_type, (fee) ) -FC_REFLECT(graphene::chain::son_wallet_withdrawal_process_operation, (fee)(payer) - (son_wallet_withdrawal_id)) +FC_REFLECT(graphene::chain::son_wallet_withdraw_process_operation::fee_parameters_type, (fee) ) +FC_REFLECT(graphene::chain::son_wallet_withdraw_process_operation, (fee)(payer) + (son_wallet_withdraw_id)) diff --git a/libraries/chain/include/graphene/chain/protocol/types.hpp b/libraries/chain/include/graphene/chain/protocol/types.hpp index c2911cdf..ac6ec067 100644 --- a/libraries/chain/include/graphene/chain/protocol/types.hpp +++ b/libraries/chain/include/graphene/chain/protocol/types.hpp @@ -149,7 +149,7 @@ namespace graphene { namespace chain { son_proposal_object_type, son_wallet_object_type, son_wallet_deposit_object_type, - son_wallet_withdrawal_object_type, + son_wallet_withdraw_object_type, sidechain_address_object_type, OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types }; @@ -216,7 +216,7 @@ namespace graphene { namespace chain { class son_proposal_object; class son_wallet_object; class son_wallet_deposit_object; - class son_wallet_withdrawal_object; + class son_wallet_withdraw_object; class sidechain_address_object; typedef object_id< protocol_ids, account_object_type, account_object> account_id_type; @@ -248,7 +248,7 @@ namespace graphene { namespace chain { typedef object_id< protocol_ids, son_proposal_object_type, son_proposal_object> son_proposal_id_type; typedef object_id< protocol_ids, son_wallet_object_type, son_wallet_object> son_wallet_id_type; typedef object_id< protocol_ids, son_wallet_deposit_object_type, son_wallet_deposit_object> son_wallet_deposit_id_type; - typedef object_id< protocol_ids, son_wallet_withdrawal_object_type, son_wallet_withdrawal_object> son_wallet_withdrawal_id_type; + typedef object_id< protocol_ids, son_wallet_withdraw_object_type, son_wallet_withdraw_object> son_wallet_withdraw_id_type; typedef object_id< protocol_ids, sidechain_address_object_type, sidechain_address_object> sidechain_address_id_type; // implementation types @@ -438,7 +438,7 @@ FC_REFLECT_ENUM( graphene::chain::object_type, (son_proposal_object_type) (son_wallet_object_type) (son_wallet_deposit_object_type) - (son_wallet_withdrawal_object_type) + (son_wallet_withdraw_object_type) (sidechain_address_object_type) (OBJECT_TYPE_COUNT) ) @@ -515,7 +515,7 @@ FC_REFLECT_TYPENAME( graphene::chain::son_id_type ) FC_REFLECT_TYPENAME( graphene::chain::son_proposal_id_type ) FC_REFLECT_TYPENAME( graphene::chain::son_wallet_id_type ) FC_REFLECT_TYPENAME( graphene::chain::son_wallet_deposit_id_type ) -FC_REFLECT_TYPENAME( graphene::chain::son_wallet_withdrawal_id_type ) +FC_REFLECT_TYPENAME( graphene::chain::son_wallet_withdraw_id_type ) FC_REFLECT_TYPENAME( graphene::chain::sidechain_address_id_type ) diff --git a/libraries/chain/include/graphene/chain/son_wallet_withdraw_evaluator.hpp b/libraries/chain/include/graphene/chain/son_wallet_withdraw_evaluator.hpp new file mode 100644 index 00000000..f5c08cd3 --- /dev/null +++ b/libraries/chain/include/graphene/chain/son_wallet_withdraw_evaluator.hpp @@ -0,0 +1,24 @@ +#pragma once +#include + +namespace graphene { namespace chain { + +class create_son_wallet_withdraw_evaluator : public evaluator +{ +public: + typedef son_wallet_withdraw_create_operation operation_type; + + void_result do_evaluate(const son_wallet_withdraw_create_operation& o); + object_id_type do_apply(const son_wallet_withdraw_create_operation& o); +}; + +class process_son_wallet_withdraw_evaluator : public evaluator +{ +public: + typedef son_wallet_withdraw_process_operation operation_type; + + void_result do_evaluate(const son_wallet_withdraw_process_operation& o); + object_id_type do_apply(const son_wallet_withdraw_process_operation& o); +}; + +} } // namespace graphene::chain diff --git a/libraries/chain/include/graphene/chain/son_wallet_withdrawal_object.hpp b/libraries/chain/include/graphene/chain/son_wallet_withdraw_object.hpp similarity index 59% rename from libraries/chain/include/graphene/chain/son_wallet_withdrawal_object.hpp rename to libraries/chain/include/graphene/chain/son_wallet_withdraw_object.hpp index 7d35eb61..4b507f85 100644 --- a/libraries/chain/include/graphene/chain/son_wallet_withdrawal_object.hpp +++ b/libraries/chain/include/graphene/chain/son_wallet_withdraw_object.hpp @@ -6,15 +6,15 @@ namespace graphene { namespace chain { using namespace graphene::db; /** - * @class son_wallet_withdrawal_object + * @class son_wallet_withdraw_object * @brief tracks information about a SON wallet withdrawal. * @ingroup object */ - class son_wallet_withdrawal_object : public abstract_object + class son_wallet_withdraw_object : public abstract_object { public: static const uint8_t space_id = protocol_ids; - static const uint8_t type_id = son_wallet_withdrawal_object_type; + static const uint8_t type_id = son_wallet_withdraw_object_type; time_point_sec timestamp; peerplays_sidechain::sidechain_type sidechain; @@ -36,33 +36,33 @@ namespace graphene { namespace chain { struct by_sidechain_uid; struct by_processed; struct by_sidechain_and_processed; - using son_wallet_withdrawal_multi_index_type = multi_index_container< - son_wallet_withdrawal_object, + using son_wallet_withdraw_multi_index_type = multi_index_container< + son_wallet_withdraw_object, indexed_by< ordered_unique< tag, member >, ordered_non_unique< tag, - member + member >, ordered_unique< tag, - member + member >, ordered_non_unique< tag, - member + member >, ordered_non_unique< tag, - composite_key, - member + composite_key, + member > > > >; - using son_wallet_withdrawal_index = generic_index; + using son_wallet_withdraw_index = generic_index; } } // graphene::chain -FC_REFLECT_DERIVED( graphene::chain::son_wallet_withdrawal_object, (graphene::db::object), +FC_REFLECT_DERIVED( graphene::chain::son_wallet_withdraw_object, (graphene::db::object), (timestamp) (sidechain) (confirmations) (sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount) (peerplays_from) (peerplays_to) (peerplays_asset) diff --git a/libraries/chain/include/graphene/chain/son_wallet_withdrawal_evaluator.hpp b/libraries/chain/include/graphene/chain/son_wallet_withdrawal_evaluator.hpp deleted file mode 100644 index 2a496996..00000000 --- a/libraries/chain/include/graphene/chain/son_wallet_withdrawal_evaluator.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once -#include - -namespace graphene { namespace chain { - -class create_son_wallet_withdrawal_evaluator : public evaluator -{ -public: - typedef son_wallet_withdrawal_create_operation operation_type; - - void_result do_evaluate(const son_wallet_withdrawal_create_operation& o); - object_id_type do_apply(const son_wallet_withdrawal_create_operation& o); -}; - -class process_son_wallet_withdrawal_evaluator : public evaluator -{ -public: - typedef son_wallet_withdrawal_process_operation operation_type; - - void_result do_evaluate(const son_wallet_withdrawal_process_operation& o); - object_id_type do_apply(const son_wallet_withdrawal_process_operation& o); -}; - -} } // namespace graphene::chain diff --git a/libraries/chain/son_wallet_withdrawal_evaluator.cpp b/libraries/chain/son_wallet_withdraw_evaluator.cpp similarity index 74% rename from libraries/chain/son_wallet_withdrawal_evaluator.cpp rename to libraries/chain/son_wallet_withdraw_evaluator.cpp index 31c221f3..52f7ee9d 100644 --- a/libraries/chain/son_wallet_withdrawal_evaluator.cpp +++ b/libraries/chain/son_wallet_withdraw_evaluator.cpp @@ -1,27 +1,27 @@ -#include +#include #include #include -#include +#include namespace graphene { namespace chain { -void_result create_son_wallet_withdrawal_evaluator::do_evaluate(const son_wallet_withdrawal_create_operation& op) +void_result create_son_wallet_withdraw_evaluator::do_evaluate(const son_wallet_withdraw_create_operation& op) { try{ FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK"); FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." ); - //const auto& idx = db().get_index_type().indices().get(); + //const auto& idx = db().get_index_type().indices().get(); //FC_ASSERT(idx.find(op.sidechain_uid) == idx.end(), "Already registered " + op.sidechain_uid); return void_result(); } FC_CAPTURE_AND_RETHROW( (op) ) } -object_id_type create_son_wallet_withdrawal_evaluator::do_apply(const son_wallet_withdrawal_create_operation& op) +object_id_type create_son_wallet_withdraw_evaluator::do_apply(const son_wallet_withdraw_create_operation& op) { try { - const auto& idx = db().get_index_type().indices().get(); + const auto& idx = db().get_index_type().indices().get(); auto itr = idx.find(op.sidechain_uid); if (itr == idx.end()) { - const auto& new_son_wallet_withdrawal_object = db().create( [&]( son_wallet_withdrawal_object& swto ){ + const auto& new_son_wallet_withdraw_object = db().create( [&]( son_wallet_withdraw_object& swto ){ swto.timestamp = op.timestamp; swto.sidechain = op.sidechain; swto.confirmations = 1; @@ -35,22 +35,22 @@ object_id_type create_son_wallet_withdrawal_evaluator::do_apply(const son_wallet swto.peerplays_asset = op.peerplays_asset; swto.processed = false; }); - return new_son_wallet_withdrawal_object.id; + return new_son_wallet_withdraw_object.id; } else { - db().modify(*itr, [&op](son_wallet_withdrawal_object &swto) { + db().modify(*itr, [&op](son_wallet_withdraw_object &swto) { swto.confirmations = swto.confirmations + 1; }); return (*itr).id; } } FC_CAPTURE_AND_RETHROW( (op) ) } -void_result process_son_wallet_withdrawal_evaluator::do_evaluate(const son_wallet_withdrawal_process_operation& op) +void_result process_son_wallet_withdraw_evaluator::do_evaluate(const son_wallet_withdraw_process_operation& op) { try{ FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK"); FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." ); - const auto& idx = db().get_index_type().indices().get(); - const auto& itr = idx.find(op.son_wallet_withdrawal_id); + const auto& idx = db().get_index_type().indices().get(); + const auto& itr = idx.find(op.son_wallet_withdraw_id); FC_ASSERT(itr != idx.end(), "Son wallet transfer not found"); //FC_ASSERT(itr->processed == false, "Son wallet transfer is already processed"); @@ -96,14 +96,14 @@ void_result process_son_wallet_withdrawal_evaluator::do_evaluate(const son_walle } FC_RETHROW_EXCEPTIONS( error, "Unable to transfer ${a} from ${f} to ${t}", ("a",d.to_pretty_string(itr->peerplays_asset))("f",from_account.name)("t",to_account.name) ); } FC_CAPTURE_AND_RETHROW( (op) ) } -object_id_type process_son_wallet_withdrawal_evaluator::do_apply(const son_wallet_withdrawal_process_operation& op) +object_id_type process_son_wallet_withdraw_evaluator::do_apply(const son_wallet_withdraw_process_operation& op) { try { - const auto& idx = db().get_index_type().indices().get(); - auto itr = idx.find(op.son_wallet_withdrawal_id); + const auto& idx = db().get_index_type().indices().get(); + auto itr = idx.find(op.son_wallet_withdraw_id); if(itr != idx.end()) { if (itr->processed == false) { - db().modify(*itr, [&op](son_wallet_withdrawal_object &swto) { + db().modify(*itr, [&op](son_wallet_withdraw_object &swto) { swto.processed = true; }); @@ -114,7 +114,7 @@ object_id_type process_son_wallet_withdrawal_evaluator::do_apply(const son_walle db().adjust_balance( to_account, itr->peerplays_asset ); } } - return op.son_wallet_withdrawal_id; + return op.son_wallet_withdraw_id; } FC_CAPTURE_AND_RETHROW( (op) ) } } } // namespace graphene::chain diff --git a/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp b/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp index e342bd9e..dfe92bff 100644 --- a/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp +++ b/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -417,20 +417,20 @@ void peerplays_sidechain_plugin_impl::process_deposits() { void peerplays_sidechain_plugin_impl::process_withdrawals() { - const auto& idx = plugin.database().get_index_type().indices().get(); + const auto& idx = plugin.database().get_index_type().indices().get(); const auto& idx_range = idx.equal_range(false); std::for_each(idx_range.first, idx_range.second, - [&] (const son_wallet_withdrawal_object& swwo) { + [&] (const son_wallet_withdraw_object& swwo) { const chain::global_property_object& gpo = plugin.database().get_global_properties(); for (son_id_type son_id : plugin.get_sons()) { if (plugin.is_active_son(son_id)) { - //son_wallet_withdrawal_process_operation p_op; + //son_wallet_withdraw_process_operation p_op; //p_op.payer = GRAPHENE_SON_ACCOUNT; - //p_op.son_wallet_withdrawal_id = swwo.id; + //p_op.son_wallet_withdraw_id = swwo.id; // //proposal_create_operation proposal_op; //proposal_op.fee_paying_account = plugin.get_son_object(son_id).son_account; diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp index 5a2f9bb7..a660a2b6 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp @@ -119,7 +119,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_ // Withdrawal request if ((sed.peerplays_to == GRAPHENE_SON_ACCOUNT) && (sed.sidechain_currency.compare("1.3.0") == 0)) { - son_wallet_withdrawal_create_operation op; + son_wallet_withdraw_create_operation op; op.payer = GRAPHENE_SON_ACCOUNT; op.timestamp = sed.timestamp; op.sidechain = sed.sidechain; diff --git a/programs/js_operation_serializer/main.cpp b/programs/js_operation_serializer/main.cpp index 684d4d7d..3c2c2577 100644 --- a/programs/js_operation_serializer/main.cpp +++ b/programs/js_operation_serializer/main.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include