Scorum
proposal_create_evaluator.cpp
Go to the documentation of this file.
2 
4 
10 
12 
13 namespace scorum {
14 namespace chain {
15 
17  : evaluator_impl<data_service_factory_i, proposal_create_evaluator>(services)
18  , _account_service(db().account_service())
19  , _proposal_service(db().proposal_service())
20  , _property_service(db().dynamic_global_property_service())
21 {
22 }
23 
25 {
26  FC_ASSERT((op.lifetime_sec <= SCORUM_PROPOSAL_LIFETIME_MAX_SECONDS
27  && op.lifetime_sec >= SCORUM_PROPOSAL_LIFETIME_MIN_SECONDS),
28  "Proposal life time is not in range of ${min} - ${max} seconds.",
29  ("min", SCORUM_PROPOSAL_LIFETIME_MIN_SECONDS)("max", SCORUM_PROPOSAL_LIFETIME_MAX_SECONDS));
30 
32 
33  FC_ASSERT(committee.as_committee_i().is_exists(op.creator), "Account \"${account_name}\" is not in committee.",
34  ("account_name", op.creator));
35 
36  _account_service.check_account_existence(op.creator);
37 
38  const fc::time_point_sec expiration = _property_service.head_block_time() + op.lifetime_sec;
39 
41 
42  _proposal_service.create_proposal(op.creator, op.operation, expiration, quorum);
43 }
44 
45 } // namespace chain
46 } // namespace scorum
proposal_create_evaluator(data_service_factory_i &services)
uint16_t percent_type
Definition: types.hpp:69
protocol::percent_type operation_get_required_quorum(committee &committee_service, const proposal_operation &op)
Definition: asset.cpp:15
virtual void check_account_existence(const account_name_type &, const optional< const char * > &context_type_name=optional< const char * >()) const =0
virtual fc::time_point_sec head_block_time() const =0
virtual const proposal_object & create_proposal(const account_name_type &creator, const protocol::proposal_operation &operation, const fc::time_point_sec &expiration, uint64_t quorum)=0
virtual bool is_exists(const account_name_type &) const =0