Rename son_wallet_withdrawal* to son_wallet_withdraw*
This commit is contained in:
parent
9ac8bbe06a
commit
22c12f5041
14 changed files with 88 additions and 88 deletions
|
|
@ -328,10 +328,10 @@ struct get_impacted_account_visitor
|
||||||
void operator()( const son_wallet_deposit_process_operation& op ){
|
void operator()( const son_wallet_deposit_process_operation& op ){
|
||||||
_impacted.insert( op.payer );
|
_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 );
|
_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 );
|
_impacted.insert( op.payer );
|
||||||
}
|
}
|
||||||
void operator()( const sidechain_address_add_operation& op ){
|
void operator()( const sidechain_address_add_operation& op ){
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ add_library( graphene_chain
|
||||||
|
|
||||||
son_wallet_evaluator.cpp
|
son_wallet_evaluator.cpp
|
||||||
son_wallet_deposit_evaluator.cpp
|
son_wallet_deposit_evaluator.cpp
|
||||||
son_wallet_withdrawal_evaluator.cpp
|
son_wallet_withdraw_evaluator.cpp
|
||||||
|
|
||||||
sidechain_address_evaluator.cpp
|
sidechain_address_evaluator.cpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
#include <graphene/chain/son_proposal_object.hpp>
|
#include <graphene/chain/son_proposal_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_object.hpp>
|
#include <graphene/chain/son_wallet_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_deposit_object.hpp>
|
#include <graphene/chain/son_wallet_deposit_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_withdrawal_object.hpp>
|
#include <graphene/chain/son_wallet_withdraw_object.hpp>
|
||||||
#include <graphene/chain/sidechain_address_object.hpp>
|
#include <graphene/chain/sidechain_address_object.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/account_evaluator.hpp>
|
#include <graphene/chain/account_evaluator.hpp>
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
#include <graphene/chain/son_evaluator.hpp>
|
#include <graphene/chain/son_evaluator.hpp>
|
||||||
#include <graphene/chain/son_wallet_evaluator.hpp>
|
#include <graphene/chain/son_wallet_evaluator.hpp>
|
||||||
#include <graphene/chain/son_wallet_deposit_evaluator.hpp>
|
#include <graphene/chain/son_wallet_deposit_evaluator.hpp>
|
||||||
#include <graphene/chain/son_wallet_withdrawal_evaluator.hpp>
|
#include <graphene/chain/son_wallet_withdraw_evaluator.hpp>
|
||||||
#include <graphene/chain/sidechain_address_evaluator.hpp>
|
#include <graphene/chain/sidechain_address_evaluator.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||||
|
|
@ -262,8 +262,8 @@ void database::initialize_evaluators()
|
||||||
register_evaluator<update_son_wallet_evaluator>();
|
register_evaluator<update_son_wallet_evaluator>();
|
||||||
register_evaluator<create_son_wallet_deposit_evaluator>();
|
register_evaluator<create_son_wallet_deposit_evaluator>();
|
||||||
register_evaluator<process_son_wallet_deposit_evaluator>();
|
register_evaluator<process_son_wallet_deposit_evaluator>();
|
||||||
register_evaluator<create_son_wallet_withdrawal_evaluator>();
|
register_evaluator<create_son_wallet_withdraw_evaluator>();
|
||||||
register_evaluator<process_son_wallet_withdrawal_evaluator>();
|
register_evaluator<process_son_wallet_withdraw_evaluator>();
|
||||||
register_evaluator<add_sidechain_address_evaluator>();
|
register_evaluator<add_sidechain_address_evaluator>();
|
||||||
register_evaluator<update_sidechain_address_evaluator>();
|
register_evaluator<update_sidechain_address_evaluator>();
|
||||||
register_evaluator<delete_sidechain_address_evaluator>();
|
register_evaluator<delete_sidechain_address_evaluator>();
|
||||||
|
|
@ -313,7 +313,7 @@ void database::initialize_indexes()
|
||||||
|
|
||||||
add_index< primary_index<son_wallet_index> >();
|
add_index< primary_index<son_wallet_index> >();
|
||||||
add_index< primary_index<son_wallet_deposit_index> >();
|
add_index< primary_index<son_wallet_deposit_index> >();
|
||||||
add_index< primary_index<son_wallet_withdrawal_index> >();
|
add_index< primary_index<son_wallet_withdraw_index> >();
|
||||||
|
|
||||||
add_index< primary_index<sidechain_address_index> >();
|
add_index< primary_index<sidechain_address_index> >();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -315,10 +315,10 @@ struct get_impacted_account_visitor
|
||||||
void operator()( const son_wallet_deposit_process_operation& op ) {
|
void operator()( const son_wallet_deposit_process_operation& op ) {
|
||||||
_impacted.insert( op.payer );
|
_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 );
|
_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 );
|
_impacted.insert( op.payer );
|
||||||
}
|
}
|
||||||
void operator()( const sidechain_address_add_operation& op ) {
|
void operator()( const sidechain_address_add_operation& op ) {
|
||||||
|
|
@ -427,7 +427,7 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
|
||||||
break;
|
break;
|
||||||
} case son_wallet_deposit_object_type:{
|
} case son_wallet_deposit_object_type:{
|
||||||
break;
|
break;
|
||||||
} case son_wallet_withdrawal_object_type:{
|
} case son_wallet_withdraw_object_type:{
|
||||||
break;
|
break;
|
||||||
} case sidechain_address_object_type:{
|
} case sidechain_address_object_type:{
|
||||||
const auto& aobj = dynamic_cast<const sidechain_address_object*>(obj);
|
const auto& aobj = dynamic_cast<const sidechain_address_object*>(obj);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
#include <graphene/chain/protocol/sidechain_address.hpp>
|
#include <graphene/chain/protocol/sidechain_address.hpp>
|
||||||
#include <graphene/chain/protocol/son_wallet.hpp>
|
#include <graphene/chain/protocol/son_wallet.hpp>
|
||||||
#include <graphene/chain/protocol/son_wallet_deposit.hpp>
|
#include <graphene/chain/protocol/son_wallet_deposit.hpp>
|
||||||
#include <graphene/chain/protocol/son_wallet_withdrawal.hpp>
|
#include <graphene/chain/protocol/son_wallet_withdraw.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
|
@ -151,8 +151,8 @@ namespace graphene { namespace chain {
|
||||||
son_wallet_update_operation,
|
son_wallet_update_operation,
|
||||||
son_wallet_deposit_create_operation,
|
son_wallet_deposit_create_operation,
|
||||||
son_wallet_deposit_process_operation,
|
son_wallet_deposit_process_operation,
|
||||||
son_wallet_withdrawal_create_operation,
|
son_wallet_withdraw_create_operation,
|
||||||
son_wallet_withdrawal_process_operation,
|
son_wallet_withdraw_process_operation,
|
||||||
sidechain_address_add_operation,
|
sidechain_address_add_operation,
|
||||||
sidechain_address_update_operation,
|
sidechain_address_update_operation,
|
||||||
sidechain_address_delete_operation
|
sidechain_address_delete_operation
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
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; };
|
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; }
|
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; };
|
struct fee_parameters_type { uint64_t fee = 0; };
|
||||||
|
|
||||||
asset fee;
|
asset fee;
|
||||||
account_id_type payer;
|
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; }
|
account_id_type fee_payer()const { return payer; }
|
||||||
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
||||||
|
|
@ -43,9 +43,9 @@ namespace graphene { namespace chain {
|
||||||
|
|
||||||
} } // namespace graphene::chain
|
} } // namespace graphene::chain
|
||||||
|
|
||||||
FC_REFLECT(graphene::chain::son_wallet_withdrawal_create_operation::fee_parameters_type, (fee) )
|
FC_REFLECT(graphene::chain::son_wallet_withdraw_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)(payer)
|
||||||
(timestamp) (sidechain) (sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount) (peerplays_from) (peerplays_to) (peerplays_asset))
|
(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_withdraw_process_operation::fee_parameters_type, (fee) )
|
||||||
FC_REFLECT(graphene::chain::son_wallet_withdrawal_process_operation, (fee)(payer)
|
FC_REFLECT(graphene::chain::son_wallet_withdraw_process_operation, (fee)(payer)
|
||||||
(son_wallet_withdrawal_id))
|
(son_wallet_withdraw_id))
|
||||||
|
|
@ -149,7 +149,7 @@ namespace graphene { namespace chain {
|
||||||
son_proposal_object_type,
|
son_proposal_object_type,
|
||||||
son_wallet_object_type,
|
son_wallet_object_type,
|
||||||
son_wallet_deposit_object_type,
|
son_wallet_deposit_object_type,
|
||||||
son_wallet_withdrawal_object_type,
|
son_wallet_withdraw_object_type,
|
||||||
sidechain_address_object_type,
|
sidechain_address_object_type,
|
||||||
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
|
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_proposal_object;
|
||||||
class son_wallet_object;
|
class son_wallet_object;
|
||||||
class son_wallet_deposit_object;
|
class son_wallet_deposit_object;
|
||||||
class son_wallet_withdrawal_object;
|
class son_wallet_withdraw_object;
|
||||||
class sidechain_address_object;
|
class sidechain_address_object;
|
||||||
|
|
||||||
typedef object_id< protocol_ids, account_object_type, account_object> account_id_type;
|
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_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_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_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;
|
typedef object_id< protocol_ids, sidechain_address_object_type, sidechain_address_object> sidechain_address_id_type;
|
||||||
|
|
||||||
// implementation types
|
// implementation types
|
||||||
|
|
@ -438,7 +438,7 @@ FC_REFLECT_ENUM( graphene::chain::object_type,
|
||||||
(son_proposal_object_type)
|
(son_proposal_object_type)
|
||||||
(son_wallet_object_type)
|
(son_wallet_object_type)
|
||||||
(son_wallet_deposit_object_type)
|
(son_wallet_deposit_object_type)
|
||||||
(son_wallet_withdrawal_object_type)
|
(son_wallet_withdraw_object_type)
|
||||||
(sidechain_address_object_type)
|
(sidechain_address_object_type)
|
||||||
(OBJECT_TYPE_COUNT)
|
(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_proposal_id_type )
|
||||||
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_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_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 )
|
FC_REFLECT_TYPENAME( graphene::chain::sidechain_address_id_type )
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma once
|
||||||
|
#include <graphene/chain/evaluator.hpp>
|
||||||
|
|
||||||
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
class create_son_wallet_withdraw_evaluator : public evaluator<create_son_wallet_withdraw_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<process_son_wallet_withdraw_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
|
||||||
|
|
@ -6,15 +6,15 @@ namespace graphene { namespace chain {
|
||||||
using namespace graphene::db;
|
using namespace graphene::db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class son_wallet_withdrawal_object
|
* @class son_wallet_withdraw_object
|
||||||
* @brief tracks information about a SON wallet withdrawal.
|
* @brief tracks information about a SON wallet withdrawal.
|
||||||
* @ingroup object
|
* @ingroup object
|
||||||
*/
|
*/
|
||||||
class son_wallet_withdrawal_object : public abstract_object<son_wallet_withdrawal_object>
|
class son_wallet_withdraw_object : public abstract_object<son_wallet_withdraw_object>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const uint8_t space_id = protocol_ids;
|
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;
|
time_point_sec timestamp;
|
||||||
peerplays_sidechain::sidechain_type sidechain;
|
peerplays_sidechain::sidechain_type sidechain;
|
||||||
|
|
@ -36,33 +36,33 @@ namespace graphene { namespace chain {
|
||||||
struct by_sidechain_uid;
|
struct by_sidechain_uid;
|
||||||
struct by_processed;
|
struct by_processed;
|
||||||
struct by_sidechain_and_processed;
|
struct by_sidechain_and_processed;
|
||||||
using son_wallet_withdrawal_multi_index_type = multi_index_container<
|
using son_wallet_withdraw_multi_index_type = multi_index_container<
|
||||||
son_wallet_withdrawal_object,
|
son_wallet_withdraw_object,
|
||||||
indexed_by<
|
indexed_by<
|
||||||
ordered_unique< tag<by_id>,
|
ordered_unique< tag<by_id>,
|
||||||
member<object, object_id_type, &object::id>
|
member<object, object_id_type, &object::id>
|
||||||
>,
|
>,
|
||||||
ordered_non_unique< tag<by_sidechain>,
|
ordered_non_unique< tag<by_sidechain>,
|
||||||
member<son_wallet_withdrawal_object, peerplays_sidechain::sidechain_type, &son_wallet_withdrawal_object::sidechain>
|
member<son_wallet_withdraw_object, peerplays_sidechain::sidechain_type, &son_wallet_withdraw_object::sidechain>
|
||||||
>,
|
>,
|
||||||
ordered_unique< tag<by_sidechain_uid>,
|
ordered_unique< tag<by_sidechain_uid>,
|
||||||
member<son_wallet_withdrawal_object, std::string, &son_wallet_withdrawal_object::sidechain_uid>
|
member<son_wallet_withdraw_object, std::string, &son_wallet_withdraw_object::sidechain_uid>
|
||||||
>,
|
>,
|
||||||
ordered_non_unique< tag<by_processed>,
|
ordered_non_unique< tag<by_processed>,
|
||||||
member<son_wallet_withdrawal_object, bool, &son_wallet_withdrawal_object::processed>
|
member<son_wallet_withdraw_object, bool, &son_wallet_withdraw_object::processed>
|
||||||
>,
|
>,
|
||||||
ordered_non_unique< tag<by_sidechain_and_processed>,
|
ordered_non_unique< tag<by_sidechain_and_processed>,
|
||||||
composite_key<son_wallet_withdrawal_object,
|
composite_key<son_wallet_withdraw_object,
|
||||||
member<son_wallet_withdrawal_object, peerplays_sidechain::sidechain_type, &son_wallet_withdrawal_object::sidechain>,
|
member<son_wallet_withdraw_object, peerplays_sidechain::sidechain_type, &son_wallet_withdraw_object::sidechain>,
|
||||||
member<son_wallet_withdrawal_object, bool, &son_wallet_withdrawal_object::processed>
|
member<son_wallet_withdraw_object, bool, &son_wallet_withdraw_object::processed>
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
using son_wallet_withdrawal_index = generic_index<son_wallet_withdrawal_object, son_wallet_withdrawal_multi_index_type>;
|
using son_wallet_withdraw_index = generic_index<son_wallet_withdraw_object, son_wallet_withdraw_multi_index_type>;
|
||||||
} } // graphene::chain
|
} } // 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)
|
(timestamp) (sidechain) (confirmations)
|
||||||
(sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount)
|
(sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount)
|
||||||
(peerplays_from) (peerplays_to) (peerplays_asset)
|
(peerplays_from) (peerplays_to) (peerplays_asset)
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <graphene/chain/evaluator.hpp>
|
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
|
||||||
|
|
||||||
class create_son_wallet_withdrawal_evaluator : public evaluator<create_son_wallet_withdrawal_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<process_son_wallet_withdrawal_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
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
#include <graphene/chain/son_wallet_withdrawal_evaluator.hpp>
|
#include <graphene/chain/son_wallet_withdraw_evaluator.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/database.hpp>
|
#include <graphene/chain/database.hpp>
|
||||||
#include <graphene/chain/is_authorized_asset.hpp>
|
#include <graphene/chain/is_authorized_asset.hpp>
|
||||||
#include <graphene/chain/son_wallet_withdrawal_object.hpp>
|
#include <graphene/chain/son_wallet_withdraw_object.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
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{
|
{ try{
|
||||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
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." );
|
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||||
|
|
||||||
//const auto& idx = db().get_index_type<son_wallet_withdrawal_index>().indices().get<by_sidechain_uid>();
|
//const auto& idx = db().get_index_type<son_wallet_withdraw_index>().indices().get<by_sidechain_uid>();
|
||||||
//FC_ASSERT(idx.find(op.sidechain_uid) == idx.end(), "Already registered " + op.sidechain_uid);
|
//FC_ASSERT(idx.find(op.sidechain_uid) == idx.end(), "Already registered " + op.sidechain_uid);
|
||||||
return void_result();
|
return void_result();
|
||||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
} 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 {
|
{ try {
|
||||||
const auto& idx = db().get_index_type<son_wallet_withdrawal_index>().indices().get<by_sidechain_uid>();
|
const auto& idx = db().get_index_type<son_wallet_withdraw_index>().indices().get<by_sidechain_uid>();
|
||||||
auto itr = idx.find(op.sidechain_uid);
|
auto itr = idx.find(op.sidechain_uid);
|
||||||
if (itr == idx.end()) {
|
if (itr == idx.end()) {
|
||||||
const auto& new_son_wallet_withdrawal_object = db().create<son_wallet_withdrawal_object>( [&]( son_wallet_withdrawal_object& swto ){
|
const auto& new_son_wallet_withdraw_object = db().create<son_wallet_withdraw_object>( [&]( son_wallet_withdraw_object& swto ){
|
||||||
swto.timestamp = op.timestamp;
|
swto.timestamp = op.timestamp;
|
||||||
swto.sidechain = op.sidechain;
|
swto.sidechain = op.sidechain;
|
||||||
swto.confirmations = 1;
|
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.peerplays_asset = op.peerplays_asset;
|
||||||
swto.processed = false;
|
swto.processed = false;
|
||||||
});
|
});
|
||||||
return new_son_wallet_withdrawal_object.id;
|
return new_son_wallet_withdraw_object.id;
|
||||||
} else {
|
} else {
|
||||||
db().modify(*itr, [&op](son_wallet_withdrawal_object &swto) {
|
db().modify(*itr, [&op](son_wallet_withdraw_object &swto) {
|
||||||
swto.confirmations = swto.confirmations + 1;
|
swto.confirmations = swto.confirmations + 1;
|
||||||
});
|
});
|
||||||
return (*itr).id;
|
return (*itr).id;
|
||||||
}
|
}
|
||||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
} 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{
|
{ try{
|
||||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
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." );
|
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||||
|
|
||||||
const auto& idx = db().get_index_type<son_wallet_withdrawal_index>().indices().get<by_id>();
|
const auto& idx = db().get_index_type<son_wallet_withdraw_index>().indices().get<by_id>();
|
||||||
const auto& itr = idx.find(op.son_wallet_withdrawal_id);
|
const auto& itr = idx.find(op.son_wallet_withdraw_id);
|
||||||
FC_ASSERT(itr != idx.end(), "Son wallet transfer not found");
|
FC_ASSERT(itr != idx.end(), "Son wallet transfer not found");
|
||||||
//FC_ASSERT(itr->processed == false, "Son wallet transfer is already processed");
|
//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_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) ) }
|
} 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 {
|
{ try {
|
||||||
const auto& idx = db().get_index_type<son_wallet_withdrawal_index>().indices().get<by_id>();
|
const auto& idx = db().get_index_type<son_wallet_withdraw_index>().indices().get<by_id>();
|
||||||
auto itr = idx.find(op.son_wallet_withdrawal_id);
|
auto itr = idx.find(op.son_wallet_withdraw_id);
|
||||||
if(itr != idx.end())
|
if(itr != idx.end())
|
||||||
{
|
{
|
||||||
if (itr->processed == false) {
|
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;
|
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 );
|
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) ) }
|
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||||
|
|
||||||
} } // namespace graphene::chain
|
} } // namespace graphene::chain
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <graphene/chain/sidechain_address_object.hpp>
|
#include <graphene/chain/sidechain_address_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_object.hpp>
|
#include <graphene/chain/son_wallet_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_deposit_object.hpp>
|
#include <graphene/chain/son_wallet_deposit_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_withdrawal_object.hpp>
|
#include <graphene/chain/son_wallet_withdraw_object.hpp>
|
||||||
#include <graphene/chain/protocol/transfer.hpp>
|
#include <graphene/chain/protocol/transfer.hpp>
|
||||||
#include <graphene/peerplays_sidechain/sidechain_net_manager.hpp>
|
#include <graphene/peerplays_sidechain/sidechain_net_manager.hpp>
|
||||||
#include <graphene/utilities/key_conversion.hpp>
|
#include <graphene/utilities/key_conversion.hpp>
|
||||||
|
|
@ -417,20 +417,20 @@ void peerplays_sidechain_plugin_impl::process_deposits() {
|
||||||
|
|
||||||
void peerplays_sidechain_plugin_impl::process_withdrawals() {
|
void peerplays_sidechain_plugin_impl::process_withdrawals() {
|
||||||
|
|
||||||
const auto& idx = plugin.database().get_index_type<son_wallet_withdrawal_index>().indices().get<by_processed>();
|
const auto& idx = plugin.database().get_index_type<son_wallet_withdraw_index>().indices().get<by_processed>();
|
||||||
const auto& idx_range = idx.equal_range(false);
|
const auto& idx_range = idx.equal_range(false);
|
||||||
|
|
||||||
std::for_each(idx_range.first, idx_range.second,
|
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();
|
const chain::global_property_object& gpo = plugin.database().get_global_properties();
|
||||||
|
|
||||||
for (son_id_type son_id : plugin.get_sons()) {
|
for (son_id_type son_id : plugin.get_sons()) {
|
||||||
if (plugin.is_active_son(son_id)) {
|
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.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_create_operation proposal_op;
|
||||||
//proposal_op.fee_paying_account = plugin.get_son_object(son_id).son_account;
|
//proposal_op.fee_paying_account = plugin.get_son_object(son_id).son_account;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
||||||
|
|
||||||
// Withdrawal request
|
// Withdrawal request
|
||||||
if ((sed.peerplays_to == GRAPHENE_SON_ACCOUNT) && (sed.sidechain_currency.compare("1.3.0") == 0)) {
|
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.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
op.timestamp = sed.timestamp;
|
op.timestamp = sed.timestamp;
|
||||||
op.sidechain = sed.sidechain;
|
op.sidechain = sed.sidechain;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
#include <graphene/chain/son_object.hpp>
|
#include <graphene/chain/son_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_object.hpp>
|
#include <graphene/chain/son_wallet_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_deposit_object.hpp>
|
#include <graphene/chain/son_wallet_deposit_object.hpp>
|
||||||
#include <graphene/chain/son_wallet_withdrawal_object.hpp>
|
#include <graphene/chain/son_wallet_withdraw_object.hpp>
|
||||||
#include <graphene/chain/sidechain_address_object.hpp>
|
#include <graphene/chain/sidechain_address_object.hpp>
|
||||||
|
|
||||||
#include <fc/smart_ref_impl.hpp>
|
#include <fc/smart_ref_impl.hpp>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue