3#include <xrpl/protocol/IOUAmount.h>
4#include <xrpl/protocol/Protocol.h>
5#include <xrpl/protocol/STAmount.h>
6#include <xrpl/protocol/XRPAmount.h>
15 XRPL_ASSERT(asset.
holds<
Issue>(),
"xrpl::toSTAmount : is Issue");
16 bool const isNeg = iou.
signum() < 0;
30 bool const isNeg = xrp.
signum() < 0;
38 XRPL_ASSERT(
isXRP(asset),
"xrpl::toSTAmount : is XRP");
51 XRPL_ASSERT(asset.
holds<
MPTIssue>(),
"xrpl::toSTAmount : is MPT");
72 "xrpl::toAmount<IOUAmount> : maximum mantissa");
76 XRPL_ASSERT(!
isXRP(amt),
"xrpl::toAmount<IOUAmount> : is not XRP");
86 "xrpl::toAmount<XRPAmount> : maximum mantissa");
90 XRPL_ASSERT(
isXRP(amt),
"xrpl::toAmount<XRPAmount> : is XRP");
100 "xrpl::toAmount<MPTAmount> : maximum mantissa");
171 static_assert(kAlwaysFalse,
"Unsupported type for toAmount");
194 [](
Issue const& issue) {
204 static_assert(kAlwaysFalse,
"Unsupported type for toMaxAmount");
237 static_assert(kAlwaysFalse,
"Unsupported type for getIssue");
264 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.
mantissa_type mantissa() const noexcept
exponent_type 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)