3 #include <fc/shared_string.hpp>
4 #include <fc/shared_buffer.hpp>
12 #include <boost/multi_index/composite_key.hpp>
22 class comment_object :
public object<comment_object_type, comment_object>
26 CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(
27 comment_object, (category)(parent_permlink)(permlink)(title)(body)(json_metadata)(beneficiaries))
31 fc::shared_string category;
33 fc::shared_string parent_permlink;
35 fc::shared_string permlink;
37 fc::shared_string title;
38 fc::shared_string body;
39 fc::shared_string json_metadata;
40 time_point_sec last_update;
46 time_point_sec last_payout;
52 uint32_t children = 0;
69 time_point_sec cashout_time;
72 uint64_t total_vote_weight = 0;
74 int32_t net_votes = 0;
82 bool allow_replies =
true;
85 bool allow_votes =
true;
87 bool allow_curation_rewards =
true;
89 fc::shared_vector<beneficiary_route_type> beneficiaries;
92 bool rewarded =
false;
99 class comment_vote_object :
public object<comment_vote_object_type, comment_vote_object>
102 CHAINBASE_DEFAULT_CONSTRUCTOR(comment_vote_object)
119 time_point_sec last_update;
120 int8_t num_changes = 0;
123 template <u
int16_t ObjectType, asset_symbol_type SymbolType>
124 class comment_statistic_object :
public object<ObjectType, comment_statistic_object<ObjectType, SymbolType>>
127 CHAINBASE_DEFAULT_CONSTRUCTOR(comment_statistic_object)
129 typedef typename object<ObjectType, comment_statistic_object<ObjectType, SymbolType>>::id_type id_type;
136 asset total_payout_value = asset(0, SymbolType);
139 asset author_payout_value = asset(0, SymbolType);
142 asset curator_payout_value = asset(0, SymbolType);
145 asset beneficiary_payout_value = asset(0, SymbolType);
148 asset fund_reward_value = asset(0, SymbolType);
151 asset from_children_payout_value = asset(0, SymbolType);
154 asset to_parent_payout_value = asset(0, SymbolType);
157 using comment_statistic_scr_object = comment_statistic_object<comment_statistic_scr_object_type, SCORUM_SYMBOL>;
158 using comment_statistic_sp_object = comment_statistic_object<comment_statistic_sp_object_type, SP_SYMBOL>;
161 struct by_cashout_time;
165 struct by_last_update;
166 struct by_author_created;
167 struct by_author_rewarded;
169 typedef shared_multi_index_container<comment_object,
172 ordered_unique<tag<by_id>,
173 member<comment_object, comment_id_type, &comment_object::id>>,
174 ordered_unique<tag<by_created>,
175 composite_key<comment_object,
176 member<comment_object,
178 &comment_object::created>,
179 member<comment_object,
181 &comment_object::id>>>,
182 ordered_unique<tag<by_cashout_time>,
183 composite_key<comment_object,
184 member<comment_object,
186 &comment_object::cashout_time>,
187 member<comment_object,
189 &comment_object::id>>>,
190 ordered_unique<tag<by_permlink>,
192 composite_key<comment_object,
193 member<comment_object,
195 &comment_object::author>,
196 member<comment_object,
198 &comment_object::permlink>>,
199 composite_key_compare<std::less<account_name_type>,
201 ordered_unique<tag<by_root>,
202 composite_key<comment_object,
203 member<comment_object,
205 &comment_object::root_comment>,
206 member<comment_object,
208 &comment_object::id>>>,
209 ordered_unique<tag<by_parent>,
211 composite_key<comment_object,
212 member<comment_object,
214 &comment_object::parent_author>,
215 member<comment_object,
217 &comment_object::parent_permlink>,
218 member<comment_object,
220 &comment_object::id>>,
221 composite_key_compare<std::less<account_name_type>,
223 std::less<comment_id_type>>>
227 ordered_unique<tag<by_author_created>,
228 composite_key<comment_object,
229 member<comment_object,
231 &comment_object::author>,
232 member<comment_object,
234 &comment_object::created>,
235 member<comment_object,
237 &comment_object::id>>,
238 composite_key_compare<std::less<account_name_type>,
239 std::greater<time_point_sec>,
240 std::less<comment_id_type>>>,
241 ordered_unique<tag<by_author_rewarded>,
242 composite_key<comment_object,
243 member<comment_object,
245 &comment_object::author>,
246 member<comment_object,
248 &comment_object::rewarded>,
249 member<comment_object,
251 &comment_object::last_payout>,
252 member<comment_object,
254 &comment_object::id>>,
255 composite_key_compare<std::less<account_name_type>,
257 std::greater<time_point_sec>,
258 std::less<comment_id_type>>>
263 struct by_comment_voter;
264 struct by_voter_comment;
265 struct by_comment_weight_voter;
266 struct by_voter_last_update;
267 typedef shared_multi_index_container<comment_vote_object,
268 indexed_by<ordered_unique<tag<by_id>,
269 member<comment_vote_object,
271 &comment_vote_object::id>>,
272 ordered_unique<tag<by_comment_voter>,
273 composite_key<comment_vote_object,
274 member<comment_vote_object,
276 &comment_vote_object::comment>,
277 member<comment_vote_object,
279 &comment_vote_object::voter>>>,
280 ordered_unique<tag<by_voter_comment>,
281 composite_key<comment_vote_object,
282 member<comment_vote_object,
284 &comment_vote_object::voter>,
285 member<comment_vote_object,
287 &comment_vote_object::comment>>>,
288 ordered_unique<tag<by_voter_last_update>,
289 composite_key<comment_vote_object,
290 member<comment_vote_object,
292 &comment_vote_object::voter>,
293 member<comment_vote_object,
295 &comment_vote_object::last_update>,
296 member<comment_vote_object,
298 &comment_vote_object::comment>>,
299 composite_key_compare<std::less<account_id_type>,
300 std::greater<time_point_sec>,
301 std::less<comment_id_type>>>,
302 ordered_unique<tag<by_comment_weight_voter>,
303 composite_key<comment_vote_object,
304 member<comment_vote_object,
306 &comment_vote_object::comment>,
307 member<comment_vote_object,
309 &comment_vote_object::weight>,
310 member<comment_vote_object,
312 &comment_vote_object::voter>>,
313 composite_key_compare<std::less<comment_id_type>,
314 std::greater<uint64_t>,
315 std::less<account_id_type>>>>>
318 struct by_comment_id;
320 template <
typename CommentStatisticObjectType>
321 using comment_statistic_index
322 = shared_multi_index_container<CommentStatisticObjectType,
323 indexed_by<ordered_unique<tag<by_id>,
324 member<CommentStatisticObjectType,
325 typename CommentStatisticObjectType::id_type,
326 &CommentStatisticObjectType::id>>,
327 ordered_unique<tag<by_comment_id>,
328 member<CommentStatisticObjectType,
330 &CommentStatisticObjectType::comment>>>>;
332 using comment_statistic_scr_index = comment_statistic_index<comment_statistic_scr_object>;
333 using comment_statistic_sp_index = comment_statistic_index<comment_statistic_sp_object>;
359 (children_abs_rshares)
364 (max_accepted_payout)
367 (allow_curation_rewards)
371 CHAINBASE_SET_INDEX_TYPE( scorum::chain::comment_object, scorum::chain::comment_index )
373 FC_REFLECT( scorum::chain::comment_vote_object,
383 CHAINBASE_SET_INDEX_TYPE( scorum::chain::comment_vote_object, scorum::chain::comment_vote_index )
385 FC_REFLECT( scorum::chain::comment_statistic_scr_object,
389 (author_payout_value)
390 (curator_payout_value)
391 (beneficiary_payout_value)
393 (from_children_payout_value)
394 (to_parent_payout_value)
396 CHAINBASE_SET_INDEX_TYPE( scorum::chain::comment_statistic_scr_object, scorum::chain::comment_statistic_scr_index )
398 FC_REFLECT( scorum::chain::comment_statistic_sp_object,
402 (author_payout_value)
403 (curator_payout_value)
404 (beneficiary_payout_value)
406 (from_children_payout_value)
407 (to_parent_payout_value)
409 CHAINBASE_SET_INDEX_TYPE( scorum::chain::comment_statistic_sp_object, scorum::chain::comment_statistic_sp_index )
FC_REFLECT(appender_args,(appender)(stream)) FC_REFLECT_DERIVED(file_appender_args
oid< comment_object > comment_id_type
oid< account_object > account_id_type
oid< comment_vote_object > comment_vote_id_type
fc::safe< share_value_type > share_type
fc::fixed_string_16 account_name_type
static asset maximum(asset_symbol_type id)