rippled
SystemParameters.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED
21 #define RIPPLE_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED
22 
23 #include <ripple/basics/XRPAmount.h>
24 #include <ripple/basics/chrono.h>
25 #include <cstdint>
26 #include <string>
27 
28 namespace ripple {
29 
30 // Various protocol and system specific constant globals.
31 
32 /* The name of the system. */
33 static inline std::string const&
35 {
36  static std::string const name = "ripple";
37  return name;
38 }
39 
43 constexpr XRPAmount INITIAL_XRP{100'000'000'000 * DROPS_PER_XRP};
44 
46 inline bool
47 isLegalAmount(XRPAmount const& amount)
48 {
49  return amount <= INITIAL_XRP;
50 }
51 
54 inline bool
55 isLegalAmountSigned(XRPAmount const& amount)
56 {
57  return amount >= -INITIAL_XRP && amount <= INITIAL_XRP;
58 }
59 
60 /* The currency code for the native currency. */
61 static inline std::string const&
62 systemCurrencyCode()
63 {
64  static std::string const code = "XRP";
65  return code;
66 }
67 
69 static constexpr std::uint32_t XRP_LEDGER_EARLIEST_SEQ{32570u};
70 
73 static constexpr std::uint32_t XRP_LEDGER_EARLIEST_FEES{562177u};
74 
76 static constexpr std::uint32_t DEFAULT_LEDGERS_PER_SHARD{16384u};
77 
83 constexpr std::ratio<204, 256> preFixAmendmentMajorityCalcThreshold;
84 
85 constexpr std::ratio<80, 100> postFixAmendmentMajorityCalcThreshold;
86 
88 constexpr std::chrono::seconds const defaultAmendmentMajorityTime = weeks{2};
89 
90 } // namespace ripple
91 
93 inline std::uint16_t constexpr DEFAULT_PEER_PORT{2459};
94 
95 #endif
std::string
STL class.
ripple::INITIAL_XRP
constexpr XRPAmount INITIAL_XRP
Configure the native currency.
Definition: SystemParameters.h:43
cstdint
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::systemName
static std::string const & systemName()
Definition: SystemParameters.h:34
ripple::XRPAmount
Definition: XRPAmount.h:46
string