Scorum
witness_objects.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
7 #include <boost/multi_index/composite_key.hpp>
8 
9 namespace scorum {
10 namespace chain {
11 
20 
26 class witness_object : public object<witness_object_type, witness_object>
27 {
28 public:
29  CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(witness_object, (url))
30 
32  {
35  none
36  };
37 
38  id_type id;
39 
42  time_point_sec created;
43  fc::shared_string url;
44  uint32_t total_missed = 0;
46 
51 
53 
61 
85  fc::uint128 virtual_last_update;
86  fc::uint128 virtual_position;
87  fc::uint128 virtual_scheduled_time = fc::uint128::max_value();
89 
94 
96  time_point_sec hardfork_time_vote;
97 };
98 
99 class witness_vote_object : public object<witness_vote_object_type, witness_vote_object>
100 {
101 public:
102  CHAINBASE_DEFAULT_CONSTRUCTOR(witness_vote_object)
103 
104  id_type id;
105 
108 };
109 
111 {
112 public:
113  CHAINBASE_DEFAULT_CONSTRUCTOR(witness_schedule_object)
114 
115  id_type id;
116 
117  fc::uint128 current_virtual_time;
118  fc::array<account_name_type, SCORUM_MAX_WITNESSES_LIMIT> current_shuffled_witnesses;
119  uint8_t num_scheduled_witnesses = 1;
120 };
121 
124 {
125 public:
126  CHAINBASE_DEFAULT_CONSTRUCTOR(witness_reward_in_sp_migration_object)
127 
128  id_type id;
129 
130  share_type balance;
131 };
132 
133 struct by_vote_name;
134 struct by_name;
135 struct by_pow;
136 struct by_schedule_time;
140 typedef shared_multi_index_container<witness_object,
141  indexed_by<ordered_unique<tag<by_id>,
142  member<witness_object,
144  &witness_object::id>>,
145  ordered_unique<tag<by_name>,
146  member<witness_object,
148  &witness_object::owner>>,
149  ordered_unique<tag<by_vote_name>,
150  composite_key<witness_object,
151  member<witness_object,
152  share_type,
153  &witness_object::votes>,
154  member<witness_object,
156  &witness_object::owner>>,
157  composite_key_compare<std::greater<share_type>,
158  std::less<account_name_type>>>,
159  ordered_unique<tag<by_schedule_time>,
160  composite_key<witness_object,
161  member<witness_object,
162  fc::uint128,
163  &witness_object::
164  virtual_scheduled_time>,
165  member<witness_object,
167  &witness_object::id>>>>>
169 
170 struct by_account_witness;
171 struct by_witness_account;
172 typedef shared_multi_index_container<witness_vote_object,
173  indexed_by<ordered_unique<tag<by_id>,
174  member<witness_vote_object,
176  &witness_vote_object::id>>,
177  ordered_unique<tag<by_account_witness>,
178  composite_key<witness_vote_object,
179  member<witness_vote_object,
182  member<witness_vote_object,
185  composite_key_compare<std::less<account_id_type>,
186  std::less<witness_id_type>>>,
187  ordered_unique<tag<by_witness_account>,
188  composite_key<witness_vote_object,
189  member<witness_vote_object,
192  member<witness_vote_object,
195  composite_key_compare<std::less<witness_id_type>,
196  std::
197  less<account_id_type>>>> // indexed_by
198  >
200 
201 typedef shared_multi_index_container<witness_schedule_object,
202  indexed_by<ordered_unique<tag<by_id>,
205  &witness_schedule_object::id>>>>
207 
208 typedef shared_multi_index_container<witness_reward_in_sp_migration_object,
209  indexed_by<ordered_unique<tag<by_id>,
214 
215 } // namespace chain
216 } // namespace scorum
217 
218 // clang-format off
219 
220 FC_REFLECT_ENUM( scorum::chain::witness_object::witness_schedule_type, (top20)(timeshare)(none) )
221 
223  (id)
224  (owner)
225  (created)
226  (url)(votes)(schedule)(virtual_last_update)(virtual_position)(virtual_scheduled_time)(total_missed)
227  (last_confirmed_block_num)(signing_key)
228  (proposed_chain_props)
229  (running_version)
230  (hardfork_version_vote)(hardfork_time_vote)
231  )
232 CHAINBASE_SET_INDEX_TYPE( scorum::chain::witness_object, scorum::chain::witness_index )
233 
235 CHAINBASE_SET_INDEX_TYPE( scorum::chain::witness_vote_object, scorum::chain::witness_vote_index )
236 
238  (id)(current_virtual_time)(current_shuffled_witnesses)(num_scheduled_witnesses)
239  )
240 CHAINBASE_SET_INDEX_TYPE( scorum::chain::witness_schedule_object, scorum::chain::witness_schedule_index )
241 
243  (id)(balance)
244  )
246 
247 // clang-format on
chain_properties proposed_chain_props
hardfork_version hardfork_version_vote
witness_schedule_type schedule
#define SCORUM_MAX_WITNESSES_LIMIT
Definition: config.hpp:180
FC_REFLECT_ENUM(scorum::protocol::game_status,(created)(started)(finished)(resolved)(expired)(cancelled)) namespace fc
Definition: game_status.hpp:18
FC_REFLECT(appender_args,(appender)(stream)) FC_REFLECT_DERIVED(file_appender_args
Definition: game.cpp:4
shared_multi_index_container< witness_reward_in_sp_migration_object, indexed_by< ordered_unique< tag< by_id >, member< witness_reward_in_sp_migration_object, witness_reward_in_sp_migration_id_type, &witness_reward_in_sp_migration_object::id > > > > witness_reward_in_sp_migration_index
@ witness_reward_in_sp_migration_object_type
scorum::protocol::chain_properties chain_properties
Definition: witness.hpp:18
shared_multi_index_container< witness_vote_object, indexed_by< ordered_unique< tag< by_id >, member< witness_vote_object, witness_vote_id_type, &witness_vote_object::id > >, ordered_unique< tag< by_account_witness >, composite_key< witness_vote_object, member< witness_vote_object, account_id_type, &witness_vote_object::account >, member< witness_vote_object, witness_id_type, &witness_vote_object::witness > >, composite_key_compare< std::less< account_id_type >, std::less< witness_id_type > > >, ordered_unique< tag< by_witness_account >, composite_key< witness_vote_object, member< witness_vote_object, witness_id_type, &witness_vote_object::witness >, member< witness_vote_object, account_id_type, &witness_vote_object::account > >, composite_key_compare< std::less< witness_id_type >, std::less< account_id_type > > > > > witness_vote_index
shared_multi_index_container< witness_schedule_object, indexed_by< ordered_unique< tag< by_id >, member< witness_schedule_object, witness_schedule_id_type, &witness_schedule_object::id > > > > witness_schedule_index
shared_multi_index_container< witness_object, indexed_by< ordered_unique< tag< by_id >, member< witness_object, witness_id_type, &witness_object::id > >, ordered_unique< tag< by_name >, member< witness_object, account_name_type, &witness_object::owner > >, ordered_unique< tag< by_vote_name >, composite_key< witness_object, member< witness_object, share_type, &witness_object::votes >, member< witness_object, account_name_type, &witness_object::owner > >, composite_key_compare< std::greater< share_type >, std::less< account_name_type > > >, ordered_unique< tag< by_schedule_time >, composite_key< witness_object, member< witness_object, fc::uint128, &witness_object::virtual_scheduled_time >, member< witness_object, witness_id_type, &witness_object::id > > > > > witness_index
fc::safe< share_value_type > share_type
Definition: types.hpp:73
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
fc::sha256 digest_type
Definition: types.hpp:66
uint64_t asset_symbol_type
Definition: asset.hpp:13
Definition: asset.cpp:15