Scorum
witness_objects.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <boost/multi_index/composite_key.hpp>
6 
7 namespace scorum {
8 namespace witness {
9 
10 using namespace scorum::chain;
11 
12 #ifndef WITNESS_SPACE_ID
13 #define WITNESS_SPACE_ID 12
14 #endif
15 
17 {
20 };
21 
23 {
24  post,
26  market
27 };
28 
29 class account_bandwidth_object : public object<account_bandwidth_object_type, account_bandwidth_object>
30 {
31 public:
32  CHAINBASE_DEFAULT_CONSTRUCTOR(account_bandwidth_object)
33 
34  id_type id;
35 
38  share_type average_bandwidth;
39  share_type lifetime_bandwidth;
40  time_point_sec last_bandwidth_update;
41 };
42 
44 
46 {
47 public:
48  CHAINBASE_DEFAULT_CONSTRUCTOR(reserve_ratio_object)
49 
50  id_type id;
51 
60  int32_t average_block_size = 0;
61 
68  int64_t current_reserve_ratio = 1;
69 
79  uint128_t max_virtual_bandwidth = 0;
80 };
81 
83 
84 struct by_account_bandwidth_type;
85 
86 typedef shared_multi_index_container<account_bandwidth_object,
87  indexed_by<ordered_unique<tag<by_id>,
91  ordered_unique<tag<by_account_bandwidth_type>,
92  composite_key<account_bandwidth_object,
95  &account_bandwidth_object::account>,
98  &account_bandwidth_object::type>>>>>
100 
101 typedef shared_multi_index_container<reserve_ratio_object,
102  indexed_by<ordered_unique<tag<by_id>,
103  member<reserve_ratio_object,
105  &reserve_ratio_object::id>>>>
107 }
108 } // scorum::witness
109 
110 // clang-format off
111 
113 
115  (id)(account)(type)(average_bandwidth)(lifetime_bandwidth)(last_bandwidth_update))
116 CHAINBASE_SET_INDEX_TYPE(scorum::witness::account_bandwidth_object, scorum::witness::account_bandwidth_index)
117 
118 FC_REFLECT(
119  scorum::witness::reserve_ratio_object, (id)(average_block_size)(current_reserve_ratio)(max_virtual_bandwidth))
120 CHAINBASE_SET_INDEX_TYPE(scorum::witness::reserve_ratio_object, scorum::witness::reserve_ratio_index)
121 
122 // clang-format on
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
fc::safe< share_value_type > share_type
Definition: types.hpp:73
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
shared_multi_index_container< account_bandwidth_object, indexed_by< ordered_unique< tag< by_id >, member< account_bandwidth_object, account_bandwidth_id_type, &account_bandwidth_object::id > >, ordered_unique< tag< by_account_bandwidth_type >, composite_key< account_bandwidth_object, member< account_bandwidth_object, account_name_type, &account_bandwidth_object::account >, member< account_bandwidth_object, bandwidth_type, &account_bandwidth_object::type > > > > > account_bandwidth_index
@ post
Rate limiting posting reward eligibility over time.
@ market
Rate limiting for all other actions.
@ forum
Rate limiting for all forum related actins.
shared_multi_index_container< reserve_ratio_object, indexed_by< ordered_unique< tag< by_id >, member< reserve_ratio_object, reserve_ratio_id_type, &reserve_ratio_object::id > > > > reserve_ratio_index
Definition: asset.cpp:15
#define WITNESS_SPACE_ID