Files
rippled/src/ripple/protocol/SystemParameters.h
seelabs 761bb5744e Make XRPAmount constructor explicit:
Remove the implicit conversion from int64 to XRPAmount. The motivation for this
was noticing that many calls to `to_string` with an integer parameter type were
calling the wrong `to_string` function. Since the calls were not prefixed with
`std::`, and there is no ADL to call `std::to_string`, this was converting the
int to an `XRPAmount` and calling `to_string(XRPAmount)`.

Since `to_string(XRPAmount)` did the same thing as `to_string(int)` this error
went undetected.
2020-01-08 16:10:25 -08:00

71 lines
2.0 KiB
C++

//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED
#define RIPPLE_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED
#include <ripple/basics/XRPAmount.h>
#include <cstdint>
#include <string>
namespace ripple {
// Various protocol and system specific constant globals.
/* The name of the system. */
static inline
std::string const&
systemName ()
{
static std::string const name = "ripple";
return name;
}
/** Configure the native currency. */
/** Number of drops in the genesis account. */
constexpr
XRPAmount
INITIAL_XRP{100'000'000'000 * DROPS_PER_XRP };
/** Returns true if the amount does not exceed the initial XRP in existence. */
inline
bool isLegalAmount (XRPAmount const& amount)
{
return amount <= INITIAL_XRP;
}
/* The currency code for the native currency. */
static inline
std::string const&
systemCurrencyCode ()
{
static std::string const code = "XRP";
return code;
}
/** The XRP ledger network's earliest allowed sequence */
static
std::uint32_t constexpr
XRP_LEDGER_EARLIEST_SEQ {32570};
} // ripple
#endif