BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
chain_parameters.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #pragma once
25 
26 #include <memory>
28 
29 namespace graphene { namespace protocol {
30  struct fee_schedule;
31 
32  struct htlc_options
33  {
34  uint32_t max_timeout_secs;
36  };
37 
39  {
40  uint32_t max_custom_authority_lifetime_seconds = GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITY_LIFETIME_SECONDS;
41  uint32_t max_custom_authorities_per_account = GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITIES_PER_ACCOUNT;
42  uint32_t max_custom_authorities_per_account_op = GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITIES_PER_ACCOUNT_OP;
43  uint32_t max_custom_authority_restrictions = GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITY_RESTRICTIONS;
44  };
45 
47  {
49  std::shared_ptr<const fee_schedule> current_fees;
50  const fee_schedule& get_current_fees() const { FC_ASSERT(current_fees); return *current_fees; }
51  fee_schedule& get_mutable_fees() { FC_ASSERT(current_fees); return const_cast<fee_schedule&>(*current_fees); }
52 
53  uint8_t block_interval = GRAPHENE_DEFAULT_BLOCK_INTERVAL;
54  uint32_t maintenance_interval = GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL;
55  uint8_t maintenance_skip_slots = GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS;
56  uint32_t committee_proposal_review_period = GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC;
57  uint32_t maximum_transaction_size = GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE;
58  uint32_t maximum_block_size = GRAPHENE_DEFAULT_MAX_BLOCK_SIZE;
59  uint32_t maximum_time_until_expiration = GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION;
60  uint32_t maximum_proposal_lifetime = GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC;
61  uint8_t maximum_asset_whitelist_authorities = GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES;
62  uint8_t maximum_asset_feed_publishers = GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS;
63  uint16_t maximum_witness_count = GRAPHENE_DEFAULT_MAX_WITNESSES;
64  uint16_t maximum_committee_count = GRAPHENE_DEFAULT_MAX_COMMITTEE;
65  uint16_t maximum_authority_membership = GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP;
66  uint16_t reserve_percent_of_fee = GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE;
67  uint16_t network_percent_of_fee = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
68  uint16_t lifetime_referrer_percent_of_fee = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE;
69  uint32_t cashback_vesting_period_seconds = GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC;
71  bool count_non_member_votes = true;
72  bool allow_non_member_whitelists = false;
74  uint32_t witness_pay_vesting_seconds = GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS;
76  uint16_t max_predicate_opcode = GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE;
78  uint16_t accounts_per_fee_scale = GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE;
79  uint8_t account_fee_scale_bitshifts = GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS;
80  uint8_t max_authority_depth = GRAPHENE_MAX_SIG_CHECK_DEPTH;
81 
82  struct ext
83  {
88  };
89 
91 
92  void validate()const;
93 
95  chain_parameters(const chain_parameters& other);
97  chain_parameters& operator=(const chain_parameters& other);
98  chain_parameters& operator=(chain_parameters&& other);
99 
101  uint16_t get_market_fee_network_percent() const;
102 
104  uint16_t get_maker_fee_discount_percent() const;
105 
106  private:
107  static void safe_copy(chain_parameters& to, const chain_parameters& from);
108  };
109 
110 } } // graphene::protocol
111 
115 )
116 
118  (max_custom_authority_lifetime_seconds)
119  (max_custom_authorities_per_account)
120  (max_custom_authorities_per_account_op)
121  (max_custom_authority_restrictions)
122 )
123 
125  (updatable_htlc_options)
126  (custom_authority_options)
127  (market_fee_network_percent)
128  (maker_fee_discount_percent)
129 )
130 
132  (current_fees)
133  (block_interval)
134  (maintenance_interval)
135  (maintenance_skip_slots)
136  (committee_proposal_review_period)
137  (maximum_transaction_size)
138  (maximum_block_size)
139  (maximum_time_until_expiration)
140  (maximum_proposal_lifetime)
141  (maximum_asset_whitelist_authorities)
142  (maximum_asset_feed_publishers)
143  (maximum_witness_count)
144  (maximum_committee_count)
145  (maximum_authority_membership)
146  (reserve_percent_of_fee)
147  (network_percent_of_fee)
148  (lifetime_referrer_percent_of_fee)
149  (cashback_vesting_period_seconds)
150  (cashback_vesting_threshold)
151  (count_non_member_votes)
152  (allow_non_member_whitelists)
153  (witness_pay_per_block)
154  (worker_budget_per_day)
155  (max_predicate_opcode)
156  (fee_liquidation_threshold)
157  (accounts_per_fee_scale)
158  (account_fee_scale_bitshifts)
159  (max_authority_depth)
160  (extensions)
161  )
162 
163 GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION( graphene::protocol::chain_parameters )
#define GRAPHENE_DEFAULT_WORKER_BUDGET_PER_DAY
Definition: config.hpp:96
#define GRAPHENE_DEFAULT_MAX_COMMITTEE
Definition: config.hpp:80
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:386
#define GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP
Definition: config.hpp:73
contains all of the parameters necessary to calculate the fee for any operation
#define GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION
Definition: config.hpp:65
Definition: api.cpp:56
#define GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE
Definition: config.hpp:87
#define GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITY_LIFETIME_SECONDS
Maximum duration before a custom authority can expire (1 month)
Definition: config.hpp:143
#define GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE
Definition: config.hpp:90
#define GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS
Definition: config.hpp:91
#define GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE
Definition: config.hpp:83
optional< htlc_options > updatable_htlc_options
#define GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE
Definition: config.hpp:88
const fee_schedule & get_current_fees() const
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
#define GRAPHENE_DEFAULT_MAX_WITNESSES
Definition: config.hpp:79
optional< custom_authority_options_type > custom_authority_options
#define GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL
Definition: config.hpp:66
#define GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION(type)
Definition: types.hpp:73
#define GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITIES_PER_ACCOUNT
Maximum number of custom authorities a particular account can set.
Definition: config.hpp:145
#define GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS
Definition: config.hpp:67
std::shared_ptr< const fee_schedule > current_fees
current schedule of fees
#define GRAPHENE_MAX_SIG_CHECK_DEPTH
Definition: config.hpp:43
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
#define GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC
Definition: config.hpp:81
#define GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC
Definition: config.hpp:82
#define GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK
Definition: config.hpp:94
#define GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD
Definition: config.hpp:86
#define GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE
Definition: config.hpp:84
#define GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS
Definition: config.hpp:95
#define GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS
Definition: config.hpp:75
#define GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITIES_PER_ACCOUNT_OP
Maximum number of custom authorities a particular account can set for a particular operation...
Definition: config.hpp:147
#define GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES
Definition: config.hpp:74
#define GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC
1 year
Definition: config.hpp:85
#define GRAPHENE_DEFAULT_BLOCK_INTERVAL
Definition: config.hpp:62
#define GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE
Definition: config.hpp:63
#define GRAPHENE_DEFAULT_MAX_BLOCK_SIZE
Definition: config.hpp:64
#define GRAPHENE_DEFAULT_MAX_CUSTOM_AUTHORITY_RESTRICTIONS
Maximum number of restrictions a custom authority can contain.
Definition: config.hpp:149
#define GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD
Definition: config.hpp:89