3 #include <fc/exception/exception.hpp>
23 : _withdraw_scorumpower_route_service(services.withdraw_scorumpower_route_service())
24 , _withdraw_scorumpower_route_statistic_service(services.withdraw_scorumpower_route_statistic_service())
28 template <
typename FromObjectType,
typename ToObjectType>
29 void do_apply(
const FromObjectType& from_object,
30 const ToObjectType& to_object,
31 const uint16_t percent,
32 bool auto_vest =
false)
34 if (!_withdraw_scorumpower_route_statistic_service.
is_exists(from_object.id))
36 _withdraw_scorumpower_route_statistic_service.
create(
41 = _withdraw_scorumpower_route_statistic_service.
get(from_object.id);
43 if (!_withdraw_scorumpower_route_service.
is_exists(from_object.id, to_object.id))
45 FC_ASSERT(percent != 0,
"Cannot create a 0% destination.");
48 "Account already has the maximum number of routes.");
52 wvdo.
to_id = to_object.id;
57 _withdraw_scorumpower_route_statistic_service.
update(
60 else if (percent == 0)
62 const auto& wvr = _withdraw_scorumpower_route_service.
get(from_object.id, to_object.id);
63 _withdraw_scorumpower_route_service.
remove(wvr);
65 _withdraw_scorumpower_route_statistic_service.
update(
70 _withdraw_scorumpower_route_statistic_service.
remove(statistic);
75 const auto& wvr = _withdraw_scorumpower_route_service.
get(from_object.id, to_object.id);
83 uint16_t total_percent = _withdraw_scorumpower_route_service.
total_percent(from_object.id);
86 "More than 100% of vesting withdrawals allocated to destinations.");
97 data_service_factory_i& services)
100 , _account_service(services.account_service())
124 data_service_factory_i& services)
127 , _account_service(services.account_service())
128 , _dev_pool_service(services.dev_pool_service())
143 const auto& to_pool = _dev_pool_service.
get();
154 : _services(services)
157 , _auto_vest(auto_vest)
170 const auto& from_pool = dev_pool_service.
get();
const account_name_type & account() const
set_withdraw_scorumpower_route_context(data_service_factory_i &services, const account_name_type &account, uint16_t percent, bool auto_vest)
data_service_factory_i & services() const
void do_apply(const FromObjectType &from_object, const ToObjectType &to_object, const uint16_t percent, bool auto_vest=false)
set_withdraw_scorumpower_route_evaluator_impl(data_service_factory_i &services)
void on_apply(set_withdraw_scorumpower_route_context &ctx)
set_withdraw_scorumpower_route_to_account_evaluator(data_service_factory_i &services)
void do_apply(const operation_type &op)
~set_withdraw_scorumpower_route_to_account_evaluator()
set_withdraw_scorumpower_route_to_dev_pool_evaluator(data_service_factory_i &services)
~set_withdraw_scorumpower_route_to_dev_pool_evaluator()
void do_apply(const operation_type &op)
withdrawable_id_type from_id
withdrawable_id_type to_id
withdrawable_id_type from_id
#define SCORUM_MAX_WITHDRAW_ROUTES
#define SCORUM_100_PERCENT
fc::fixed_string_16 account_name_type
virtual const account_object & get_account(const account_name_type &) const =0
virtual void check_account_existence(const account_name_type &, const optional< const char * > &context_type_name=optional< const char * >()) const =0
virtual void update(const modifier_type &modifier)=0
virtual const object_type & get() const =0
virtual const object_type & create(const modifier_type &modifier)=0
virtual const withdraw_scorumpower_route_object & get(const account_id_type &from, const account_id_type &to) const =0
virtual bool is_exists(const account_id_type &from, const account_id_type &to) const =0
virtual uint16_t total_percent(const account_id_type &from) const =0
virtual bool is_exists(const account_id_type &from) const =0
virtual const withdraw_scorumpower_route_statistic_object & get(const account_id_type &from) const =0
Setup a versting withdraw to another account.
account_name_type from_account
account_name_type to_account
Setup a versting withdraw to development pool.
account_name_type from_account