2 #include <fc/fixed_string.hpp>
3 #include <fc/shared_string.hpp>
12 #include <boost/multi_index/composite_key.hpp>
13 #include <boost/multi_index/hashed_index.hpp>
24 class account_object :
public object<account_object_type, account_object>
27 CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(account_object, (json_metadata))
32 public_key_type memo_key;
33 fc::shared_string json_metadata;
36 time_point_sec last_account_update;
39 bool created_by_genesis =
false;
40 bool owner_challenged =
false;
41 bool active_challenged =
false;
42 time_point_sec last_owner_proved = time_point_sec::min();
43 time_point_sec last_active_proved = time_point_sec::min();
45 time_point_sec last_account_recovery;
51 time_point_sec last_vote_time;
53 time_point_sec voting_power_restoring_time;
55 asset vote_reward_competitive_sp = asset(0,
SP_SYMBOL);
60 asset delegated_scorumpower = asset(0,
SP_SYMBOL);
61 asset received_scorumpower = asset(0,
SP_SYMBOL);
63 asset nft_spend_scorumpower = asset(0,
SP_SYMBOL);
65 fc::array<share_type, SCORUM_MAX_PROXY_RECURSION_DEPTH> proxied_vsf_votes;
68 uint16_t witnesses_voted_for = 0;
70 time_point_sec last_post;
71 time_point_sec last_root_post = fc::time_point_sec::min();
73 time_point_sec active_sp_holders_cashout_time = fc::time_point_sec::maximum();
74 asset active_sp_holders_pending_scr_reward = asset(0,
SCORUM_SYMBOL);
75 asset active_sp_holders_pending_sp_reward = asset(0,
SP_SYMBOL);
80 return std::accumulate(proxied_vsf_votes.begin(), proxied_vsf_votes.end(), scorumpower.amount);
84 return std::accumulate(proxied_vsf_votes.begin(), proxied_vsf_votes.end(),
share_type());
87 asset effective_scorumpower()
const
89 return scorumpower - delegated_scorumpower + received_scorumpower;
94 class account_blogging_statistic_object
95 :
public object<account_blogging_statistic_object_type, account_blogging_statistic_object>
98 CHAINBASE_DEFAULT_CONSTRUCTOR(account_blogging_statistic_object)
104 uint32_t post_count = 0;
105 uint32_t comment_count = 0;
106 uint32_t vote_count = 0;
109 asset curation_rewards_sp = asset(0,
SP_SYMBOL);
112 asset posting_rewards_sp = asset(0,
SP_SYMBOL);
115 class account_authority_object :
public object<account_authority_object_type, account_authority_object>
119 CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(account_authority_object, (
owner)(
active)(
posting))
125 shared_authority
owner;
129 time_point_sec last_owner_update;
132 class scorumpower_delegation_object :
public object<scorumpower_delegation_object_type, scorumpower_delegation_object>
135 CHAINBASE_DEFAULT_CONSTRUCTOR(scorumpower_delegation_object)
141 time_point_sec min_delegation_time;
144 class reg_pool_sp_delegation_object :
public object<reg_pool_sp_delegation_object_type, reg_pool_sp_delegation_object>
147 CHAINBASE_DEFAULT_CONSTRUCTOR(reg_pool_sp_delegation_object)
154 class scorumpower_delegation_expiration_object
155 :
public object<scorumpower_delegation_expiration_object_type, scorumpower_delegation_expiration_object>
158 CHAINBASE_DEFAULT_CONSTRUCTOR(scorumpower_delegation_expiration_object)
163 time_point_sec expiration;
166 class owner_authority_history_object
167 :
public object<owner_authority_history_object_type, owner_authority_history_object>
170 CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(owner_authority_history_object, (previous_owner_authority))
175 shared_authority previous_owner_authority;
176 time_point_sec last_valid_time;
179 class account_recovery_request_object
180 :
public object<account_recovery_request_object_type, account_recovery_request_object>
183 CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(account_recovery_request_object, (new_owner_authority))
188 shared_authority new_owner_authority;
189 time_point_sec expires;
192 class change_recovery_account_request_object
193 :
public object<change_recovery_account_request_object_type, change_recovery_account_request_object>
196 CHAINBASE_DEFAULT_CONSTRUCTOR(change_recovery_account_request_object)
202 time_point_sec effective_on;
205 class account_registration_bonus_object
206 :
public object<account_registration_bonus_object_type, account_registration_bonus_object>
209 CHAINBASE_DEFAULT_CONSTRUCTOR(account_registration_bonus_object)
217 time_point_sec expires;
223 struct by_scorum_balance;
224 struct by_smp_balance;
225 struct by_created_by_genesis;
226 struct by_voting_power_restoring_time;
227 struct by_active_sp_holders_cashout_time;
232 typedef shared_multi_index_container<account_object,
233 indexed_by<ordered_unique<tag<by_id>,
234 member<account_object,
236 &account_object::id>>,
237 ordered_unique<tag<by_name>,
238 member<account_object,
240 &account_object::name>>,
241 ordered_non_unique<tag<by_created_by_genesis>,
242 member<account_object,
244 &account_object::created_by_genesis>>,
245 ordered_unique<tag<by_proxy>,
246 composite_key<account_object,
247 member<account_object,
249 &account_object::proxy>,
250 member<account_object,
252 &account_object::id>>
256 ordered_unique<tag<by_last_post>,
257 composite_key<account_object,
258 member<account_object,
260 &account_object::last_post>,
261 member<account_object,
263 &account_object::id>>,
264 composite_key_compare<std::greater<time_point_sec>,
265 std::less<account_id_type>>>,
266 ordered_unique<tag<by_scorum_balance>,
267 composite_key<account_object,
268 member<account_object,
270 &account_object::balance>,
271 member<account_object,
273 &account_object::id>>,
274 composite_key_compare<std::greater<asset>,
275 std::less<account_id_type>>>,
276 ordered_unique<tag<by_smp_balance>,
277 composite_key<account_object,
278 member<account_object,
280 &account_object::scorumpower>,
281 member<account_object,
283 &account_object::id>>,
284 composite_key_compare<std::greater<asset>,
285 std::less<account_id_type>>>,
286 ordered_non_unique<tag<by_voting_power_restoring_time>,
287 member<account_object,
290 voting_power_restoring_time>>,
291 ordered_unique<tag<by_active_sp_holders_cashout_time>,
292 composite_key<account_object,
293 member<account_object,
296 active_sp_holders_cashout_time>,
297 member<account_object,
299 &account_object::id>>>>>
302 struct by_account_id;
303 struct by_post_count;
304 struct by_vote_count;
306 typedef shared_multi_index_container<account_blogging_statistic_object,
307 indexed_by<ordered_unique<tag<by_id>,
308 member<account_blogging_statistic_object,
310 &account_blogging_statistic_object::id>>,
311 ordered_unique<tag<by_account_id>,
312 member<account_blogging_statistic_object,
314 &account_blogging_statistic_object::account>>,
315 ordered_unique<tag<by_post_count>,
316 composite_key<account_blogging_statistic_object,
317 member<account_blogging_statistic_object,
319 &account_blogging_statistic_object::
321 member<account_blogging_statistic_object,
323 &account_blogging_statistic_object::
325 composite_key_compare<std::greater<uint32_t>,
326 std::less<account_id_type>>>,
327 ordered_unique<tag<by_vote_count>,
328 composite_key<account_blogging_statistic_object,
329 member<account_blogging_statistic_object,
331 &account_blogging_statistic_object::
333 member<account_blogging_statistic_object,
335 &account_blogging_statistic_object::
337 composite_key_compare<std::greater<uint32_t>,
338 std::less<account_id_type>>>>>
339 account_blogging_statistic_index;
342 struct by_last_valid;
344 typedef shared_multi_index_container<owner_authority_history_object,
345 indexed_by<ordered_unique<tag<by_id>,
346 member<owner_authority_history_object,
348 &owner_authority_history_object::id>>,
349 ordered_unique<tag<by_account>,
350 composite_key<owner_authority_history_object,
351 member<owner_authority_history_object,
353 &owner_authority_history_object::
355 member<owner_authority_history_object,
357 &owner_authority_history_object::
359 member<owner_authority_history_object,
361 &owner_authority_history_object::
363 composite_key_compare<std::less<account_name_type>,
364 std::less<time_point_sec>,
366 less<owner_authority_history_id_type>>>>>
367 owner_authority_history_index;
369 struct by_last_owner_update;
371 typedef shared_multi_index_container<account_authority_object,
372 indexed_by<ordered_unique<tag<by_id>,
373 member<account_authority_object,
375 &account_authority_object::id>>,
376 ordered_unique<tag<by_account>,
377 composite_key<account_authority_object,
378 member<account_authority_object,
380 &account_authority_object::account>,
381 member<account_authority_object,
383 &account_authority_object::id>>,
384 composite_key_compare<std::less<account_name_type>,
386 less<account_authority_id_type>>>,
387 ordered_unique<tag<by_last_owner_update>,
388 composite_key<account_authority_object,
389 member<account_authority_object,
391 &account_authority_object::
393 member<account_authority_object,
395 &account_authority_object::id>>,
396 composite_key_compare<std::greater<time_point_sec>,
398 less<account_authority_id_type>>>>>
399 account_authority_index;
401 struct by_delegation;
403 typedef shared_multi_index_container<scorumpower_delegation_object,
404 indexed_by<ordered_unique<tag<by_id>,
405 member<scorumpower_delegation_object,
407 &scorumpower_delegation_object::id>>,
408 ordered_unique<tag<by_delegation>,
409 composite_key<scorumpower_delegation_object,
410 member<scorumpower_delegation_object,
412 &scorumpower_delegation_object::
414 member<scorumpower_delegation_object,
416 &scorumpower_delegation_object::
418 composite_key_compare<std::less<account_name_type>,
419 std::less<account_name_type>>>>>
420 scorumpower_delegation_index;
424 typedef shared_multi_index_container<reg_pool_sp_delegation_object,
425 indexed_by<ordered_unique<tag<by_id>,
426 member<reg_pool_sp_delegation_object,
428 ®_pool_sp_delegation_object::id>>,
429 hashed_unique<tag<by_delegatee>,
430 member<reg_pool_sp_delegation_object,
432 ®_pool_sp_delegation_object::delegatee>>>>
433 reg_pool_sp_delegation_index;
435 struct by_expiration;
436 struct by_account_expiration;
438 typedef shared_multi_index_container<scorumpower_delegation_expiration_object,
439 indexed_by<ordered_unique<tag<by_id>,
440 member<scorumpower_delegation_expiration_object,
442 &scorumpower_delegation_expiration_object::id>>,
443 ordered_unique<tag<by_expiration>,
444 composite_key<scorumpower_delegation_expiration_object,
445 member<scorumpower_delegation_expiration_object,
447 &scorumpower_delegation_expiration_object::
449 member<scorumpower_delegation_expiration_object,
451 &scorumpower_delegation_expiration_object::
453 composite_key_compare<std::less<time_point_sec>,
455 less<scorumpower_delegation_expiration_id_type>>>,
456 ordered_unique<tag<by_account_expiration>,
457 composite_key<scorumpower_delegation_expiration_object,
458 member<scorumpower_delegation_expiration_object,
460 &scorumpower_delegation_expiration_object::
462 member<scorumpower_delegation_expiration_object,
464 &scorumpower_delegation_expiration_object::
466 member<scorumpower_delegation_expiration_object,
468 &scorumpower_delegation_expiration_object::
470 composite_key_compare<std::less<account_name_type>,
471 std::less<time_point_sec>,
473 less<scorumpower_delegation_expiration_id_type>>>>>
474 scorumpower_delegation_expiration_index;
476 typedef shared_multi_index_container<account_recovery_request_object,
477 indexed_by<ordered_unique<tag<by_id>,
478 member<account_recovery_request_object,
480 &account_recovery_request_object::id>>,
481 ordered_unique<tag<by_account>,
482 composite_key<account_recovery_request_object,
483 member<account_recovery_request_object,
485 &account_recovery_request_object::
487 member<account_recovery_request_object,
489 &account_recovery_request_object::
491 composite_key_compare<std::less<account_name_type>,
493 less<account_recovery_request_id_type>>>,
494 ordered_unique<tag<by_expiration>,
495 composite_key<account_recovery_request_object,
496 member<account_recovery_request_object,
498 &account_recovery_request_object::
500 member<account_recovery_request_object,
502 &account_recovery_request_object::
504 composite_key_compare<std::less<time_point_sec>,
506 less<account_recovery_request_id_type>>>>>
507 account_recovery_request_index;
509 struct by_effective_date;
511 typedef shared_multi_index_container<change_recovery_account_request_object,
512 indexed_by<ordered_unique<tag<by_id>,
513 member<change_recovery_account_request_object,
515 &change_recovery_account_request_object::id>>,
516 ordered_unique<tag<by_account>,
517 composite_key<change_recovery_account_request_object,
518 member<change_recovery_account_request_object,
520 &change_recovery_account_request_object::
522 member<change_recovery_account_request_object,
524 &change_recovery_account_request_object::
526 composite_key_compare<std::less<account_name_type>,
528 less<change_recovery_account_request_id_type>>>,
529 ordered_unique<tag<by_effective_date>,
530 composite_key<change_recovery_account_request_object,
531 member<change_recovery_account_request_object,
533 &change_recovery_account_request_object::
535 member<change_recovery_account_request_object,
537 &change_recovery_account_request_object::
539 composite_key_compare<std::less<time_point_sec>,
541 less<change_recovery_account_request_id_type>>>>>
542 change_recovery_account_request_index;
544 typedef shared_multi_index_container<account_registration_bonus_object,
545 indexed_by<ordered_unique<tag<by_id>,
546 member<account_registration_bonus_object,
548 &account_registration_bonus_object::id>>,
549 ordered_unique<tag<by_account>,
550 member<account_registration_bonus_object,
552 &account_registration_bonus_object::account>>,
553 ordered_unique<tag<by_expiration>,
554 composite_key<account_registration_bonus_object,
555 member<account_registration_bonus_object,
557 &account_registration_bonus_object::
559 member<account_registration_bonus_object,
561 &account_registration_bonus_object::
563 account_registration_bonus_index;
570 (
id)(name)(memo_key)(json_metadata)(proxy)(last_account_update)
571 (created)(created_by_genesis)
572 (owner_challenged)(active_challenged)(last_owner_proved)(last_active_proved)(recovery_account)(last_account_recovery)
573 (can_vote)(voting_power)(last_vote_time)(voting_power_restoring_time)(vote_reward_competitive_sp)
575 (scorumpower)(delegated_scorumpower)(received_scorumpower)(nft_spend_scorumpower)
576 (proxied_vsf_votes)(witnesses_voted_for)
577 (last_post)(last_root_post)
578 (active_sp_holders_cashout_time)
579 (active_sp_holders_pending_scr_reward)
580 (active_sp_holders_pending_sp_reward)
582 CHAINBASE_SET_INDEX_TYPE( scorum::chain::account_object, scorum::chain::account_index )
584 FC_REFLECT( scorum::chain::account_blogging_statistic_object,
586 (post_count)(comment_count)(vote_count)
587 (curation_rewards_scr)(curation_rewards_sp)
588 (posting_rewards_scr)(posting_rewards_sp)
590 CHAINBASE_SET_INDEX_TYPE( scorum::chain::account_blogging_statistic_object, scorum::chain::account_blogging_statistic_index )
592 FC_REFLECT( scorum::chain::account_authority_object,
595 CHAINBASE_SET_INDEX_TYPE( scorum::chain::account_authority_object, scorum::chain::account_authority_index )
597 FC_REFLECT( scorum::chain::scorumpower_delegation_object,
598 (
id)(delegator)(delegatee)(scorumpower)(min_delegation_time) )
599 CHAINBASE_SET_INDEX_TYPE( scorum::chain::scorumpower_delegation_object, scorum::chain::scorumpower_delegation_index )
601 FC_REFLECT( scorum::chain::reg_pool_sp_delegation_object,
602 (
id)(delegatee)(
sp) )
603 CHAINBASE_SET_INDEX_TYPE( scorum::chain::reg_pool_sp_delegation_object, scorum::chain::reg_pool_sp_delegation_index )
605 FC_REFLECT( scorum::chain::scorumpower_delegation_expiration_object,
606 (
id)(delegator)(scorumpower)(expiration) )
607 CHAINBASE_SET_INDEX_TYPE( scorum::chain::scorumpower_delegation_expiration_object, scorum::chain::scorumpower_delegation_expiration_index )
609 FC_REFLECT( scorum::chain::owner_authority_history_object,
610 (
id)(account)(previous_owner_authority)(last_valid_time)
612 CHAINBASE_SET_INDEX_TYPE( scorum::chain::owner_authority_history_object, scorum::chain::owner_authority_history_index )
614 FC_REFLECT( scorum::chain::account_recovery_request_object,
615 (
id)(account_to_recover)(new_owner_authority)(expires)
617 CHAINBASE_SET_INDEX_TYPE( scorum::chain::account_recovery_request_object, scorum::chain::account_recovery_request_index )
619 FC_REFLECT( scorum::chain::change_recovery_account_request_object,
620 (
id)(account_to_recover)(recovery_account)(effective_on)
622 CHAINBASE_SET_INDEX_TYPE( scorum::chain::change_recovery_account_request_object, scorum::chain::change_recovery_account_request_index )
624 FC_REFLECT( scorum::chain::account_registration_bonus_object,
625 (
id)(account)(bonus)(expires)
627 CHAINBASE_SET_INDEX_TYPE( scorum::chain::account_registration_bonus_object, scorum::chain::account_registration_bonus_index )
#define SCORUM_100_PERCENT
FC_REFLECT(appender_args,(appender)(stream)) FC_REFLECT_DERIVED(file_appender_args
oid< change_recovery_account_request_object > change_recovery_account_request_id_type
oid< scorumpower_delegation_expiration_object > scorumpower_delegation_expiration_id_type
oid< account_blogging_statistic_object > account_blogging_statistic_id_type
oid< account_registration_bonus_object > account_registration_bonus_id_type
oid< reg_pool_sp_delegation_object > reg_pool_sp_delegation_id_type
oid< account_authority_object > account_authority_id_type
oid< account_recovery_request_object > account_recovery_request_id_type
oid< scorumpower_delegation_object > scorumpower_delegation_id_type
oid< account_object > account_id_type
oid< owner_authority_history_object > owner_authority_history_id_type
fc::safe< share_value_type > share_type
fc::fixed_string_16 account_name_type