Scorum
proposal_evaluators.hpp
Go to the documentation of this file.
1 #pragma once
2 
6 
10 
11 namespace scorum {
12 namespace chain {
13 
14 struct data_service_factory_i;
15 
16 template <typename EvaluatorType>
19 
20 template <typename OperationType>
21 struct proposal_add_member_evaluator : public proposal_operation_evaluator<proposal_add_member_evaluator<OperationType>>
22 {
23  typedef OperationType operation_type;
24 
25  proposal_add_member_evaluator(data_service_factory_i& r)
27  {
28  }
29 
30  void do_apply(const operation_type& o)
31  {
32  auto committee = get_committee(this->db(), o);
33  committee.as_committee_i().add_member(o.account_name);
34  }
35 };
36 
37 template <typename OperationType>
39  : public proposal_operation_evaluator<proposal_exclude_member_evaluator<OperationType>>
40 {
41  typedef OperationType operation_type;
42 
43  proposal_exclude_member_evaluator(data_service_factory_i& s, fc::flat_set<account_name_type>& members)
45  , removed_members(members)
46  {
47  }
48 
49  void do_apply(const operation_type& o)
50  {
51  auto committee = get_committee(this->db(), o);
52  committee.as_committee_i().exclude_member(o.account_name);
53 
54  removed_members.insert(o.account_name);
55  }
56 
57 private:
58  fc::flat_set<account_name_type>& removed_members;
59 };
60 
61 template <typename OperationType>
63  : public proposal_operation_evaluator<proposal_change_quorum_evaluator<OperationType>>
64 {
65  typedef OperationType operation_type;
66 
67  proposal_change_quorum_evaluator(data_service_factory_i& r)
69  {
70  }
71 
72  void do_apply(const operation_type& o)
73  {
74  committee committee = get_committee(this->db(), o);
75 
76  switch (o.committee_quorum)
77  {
80  break;
83  break;
86  break;
88  committee.weak_visit([&](development_committee_i& c) { c.change_transfer_quorum(o.quorum); });
89  break;
91  committee.weak_visit([&](development_committee_i& c) { c.change_advertising_moderator_quorum(o.quorum); });
92  break;
94  committee.weak_visit([&](development_committee_i& c) { c.change_betting_moderator_quorum(o.quorum); });
95  break;
97  committee.weak_visit([&](development_committee_i& c) { c.change_betting_resolve_delay_quorum(o.quorum); });
98  break;
100  committee.weak_visit(
102  break;
104  FC_THROW_EXCEPTION(fc::assert_exception, "unknow quorum change operation");
105  }
106  }
107 };
108 
110  : public proposal_operation_evaluator<development_committee_withdraw_vesting_evaluator>
111 {
113 
114  development_committee_withdraw_vesting_evaluator(data_service_factory_i& r);
115 
116  void do_apply(const operation_type& o);
117 };
118 
120  : public proposal_operation_evaluator<development_committee_transfer_evaluator>
121 {
123 
124  development_committee_transfer_evaluator(data_service_factory_i& r);
125 
126  void do_apply(const operation_type& o);
127 };
128 
130  : public proposal_operation_evaluator<development_committee_empower_advertising_moderator_evaluator>
131 {
133 
135 
136  void do_apply(const operation_type& o);
137 };
138 
140  : public proposal_operation_evaluator<development_committee_empower_betting_moderator_evaluator>
141 {
143 
145 
146  void do_apply(const operation_type& o);
147 };
148 
150  : public proposal_operation_evaluator<development_committee_change_betting_resolve_delay_evaluator>
151 {
153 
155 
156  void do_apply(const operation_type& o);
157 };
158 
159 template <budget_type type>
161  : public proposal_operation_evaluator<development_committee_change_budgets_auction_properties_evaluator<type>>
162 {
163 public:
165  using base_type
167 
169  : base_type(r)
170  {
171  }
172 
173  void do_apply(const operation_type& o);
174 };
175 
178 
181 
182 namespace registration_committee {
183 
186 
189 
192 
193 } // namespace registration_committee
194 
195 namespace development_committee {
196 
199 
202 
205 
208 
209 } // namespace development_committee
210 
211 } // namespace chain
212 } // namespace scorum
DataServices & db() const
Definition: evaluator.hpp:34
protocol::committee get_committee(data_service_factory_i &services, const protocol::proposal_committee_operation< protocol::registration_committee_i > &)
Definition: asset.cpp:15
development_committee_change_betting_resolve_delay_operation operation_type
development_committee_empower_advertising_moderator_operation operation_type
development_committee_empower_betting_moderator_operation operation_type
development_committee_transfer_operation operation_type
development_committee_withdraw_vesting_operation operation_type
proposal_add_member_evaluator(data_service_factory_i &r)
proposal_exclude_member_evaluator(data_service_factory_i &s, fc::flat_set< account_name_type > &members)
virtual void change_add_member_quorum(const protocol::percent_type)=0
virtual void exclude_member(const account_name_type &)=0
virtual void change_base_quorum(const protocol::percent_type)=0
virtual void change_exclude_member_quorum(const protocol::percent_type)=0
virtual void add_member(const account_name_type &)=0
virtual void change_betting_resolve_delay_quorum(const protocol::percent_type)=0
virtual void change_budgets_auction_properties_quorum(const protocol::percent_type)=0
virtual void change_betting_moderator_quorum(const protocol::percent_type)=0
virtual void change_transfer_quorum(const protocol::percent_type)=0
virtual void change_advertising_moderator_quorum(const protocol::percent_type)=0