3#include <xrpl/basics/Number.h>
4#include <xrpl/basics/contract.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/protocol/Asset.h>
7#include <xrpl/protocol/IOUAmount.h>
8#include <xrpl/protocol/Issue.h>
9#include <xrpl/protocol/MPTAmount.h>
10#include <xrpl/protocol/MPTIssue.h>
11#include <xrpl/protocol/Protocol.h>
12#include <xrpl/protocol/STAmount.h>
13#include <xrpl/protocol/XRPAmount.h>
25 XRPL_ASSERT(asset.
holds<
Issue>(),
"xrpl::toSTAmount : is Issue");
26 bool const isNeg = iou.
signum() < 0;
40 bool const isNeg = xrp.
signum() < 0;
48 XRPL_ASSERT(
isXRP(asset),
"xrpl::toSTAmount : is XRP");
61 XRPL_ASSERT(asset.
holds<
MPTIssue>(),
"xrpl::toSTAmount : is MPT");
82 "xrpl::toAmount<IOUAmount> : maximum mantissa");
86 XRPL_ASSERT(!
isXRP(amt),
"xrpl::toAmount<IOUAmount> : is not XRP");
96 "xrpl::toAmount<XRPAmount> : maximum mantissa");
100 XRPL_ASSERT(
isXRP(amt),
"xrpl::toAmount<XRPAmount> : is XRP");
110 "xrpl::toAmount<MPTAmount> : maximum mantissa");
181 static_assert(kAlwaysFalse,
"Unsupported type for toAmount");
204 [](
Issue const& issue) {
214 static_assert(kAlwaysFalse,
"Unsupported type for toMaxAmount");
247 static_assert(kAlwaysFalse,
"Unsupported type for getIssue");
274 static_assert(kAlwaysFalse,
"Unsupported type for get");
constexpr auto visit(Visitors &&... visitors) const -> decltype(auto)
constexpr TIss const & get() const
constexpr bool holds() const
Floating point representation of amounts with high dynamic range.
MantissaType mantissa() const noexcept
ExponentType exponent() const noexcept
int signum() const noexcept
Return the sign of the amount.
A currency issued by an account.
Number is a floating point type that can represent a wide range of values.
static RoundingMode setround(RoundingMode inMode)
static RoundingMode getround()
constexpr bool holds() const noexcept
std::uint64_t mantissa() const noexcept
bool negative() const noexcept
static constexpr std::uint64_t kMaxNativeN
int exponent() const noexcept
static constexpr std::uint64_t kMaxValue
static constexpr int kMaxOffset
constexpr value_type drops() const
Returns the number of drops.
constexpr int signum() const noexcept
Return the sign of the amount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
bool isXRP(AccountID const &c)
T toMaxAmount(Asset const &asset)
MPTAmount toAmount< MPTAmount >(STAmount const &amt)
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
T toAmount(STAmount const &amt)=delete
XRPAmount toAmount< XRPAmount >(STAmount const &amt)
Asset getAsset(T const &amt)
IOUAmount toAmount< IOUAmount >(STAmount const &amt)
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
constexpr std::uint64_t kMaxMpTokenAmount
The maximum amount of MPTokenIssuance.
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
STAmount toSTAmount(IOUAmount const &iou, Asset const &asset)
STAmount toAmount< STAmount >(STAmount const &amt)