20#ifndef RIPPLE_TEST_JTX_AMOUNT_H_INCLUDED
21#define RIPPLE_TEST_JTX_AMOUNT_H_INCLUDED
23#include <test/jtx/Account.h>
24#include <test/jtx/tags.h>
26#include <xrpl/basics/contract.h>
27#include <xrpl/protocol/Issue.h>
28#include <xrpl/protocol/STAmount.h>
29#include <xrpl/protocol/Units.h>
108 :
amount_((v > 0) ? v : -v, v < 0)
186 template <
typename A>
214 template <std::
integral T>
268 template <
class T,
class = std::enable_if_t<std::is_
integral_v<T>>>
284 if (
double(d) / c != v)
285 Throw<std::domain_error>(
"unrepresentable");
289 if (
double(d) / c != v)
290 Throw<std::domain_error>(
"unrepresentable");
322template <
class Integer,
class = std::enable_if_t<std::is_
integral_v<Integer>>>
495 operator()(T v)
const
516 Throw<std::logic_error>(
"MPT is not supported");
A currency issued by an account.
void setIssuer(AccountID const &uIssuer)
int signum() const noexcept
constexpr value_type drops() const
Returns the number of drops.
Immutable cryptographic account descriptor.
AccountID id() const
Returns the Account ID.
std::string const & name() const
Return the name.
Converts to IOU Issue or STAmount.
ripple::Currency currency
IOU(Account const &account_, ripple::Currency const ¤cy_)
friend BookSpec operator~(IOU const &iou)
None operator()(none_t) const
Returns None-of-Issue.
PrettyAmount operator()(T v) const
Converts to MPT Issue or STAmount.
friend BookSpec operator~(MPT const &mpt)
PrettyAmount operator()(epsilon_t) const
MPT(std::string const &n, ripple::MPTID const &issuanceID_)
ripple::MPTIssue mptIssue() const
Explicit conversion to MPTIssue or asset.
None operator()(none_t) const
Returns None-of-Issue.
ripple::MPTID const & mpt() const
PrettyAmount operator()(detail::epsilon_multiple) const
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
std::ostream & operator<<(std::ostream &os, PrettyAmount const &amount)
constexpr XRPAmount dropsPerXRP
bool operator!=(PrettyAmount const &lhs, PrettyAmount const &rhs)
static epsilon_t const epsilon
any_t const any
Returns an amount representing "any issuer".
bool operator==(Account const &lhs, Account const &rhs) noexcept
XRP_t const XRP
Converts to XRP Issue or STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
AccountID const & xrpAccount()
Compute AccountID from public key.
Currency const & noCurrency()
A placeholder for empty currencies.
Json::Value to_json(Asset const &asset)
Currency const & xrpCurrency()
XRP currency.
STAmount amountFromString(Asset const &asset, std::string const &amount)
Amount specifier with an option for any issuer.
void to(AccountID const &id)
AnyAmount(STAmount const &amount)
AnyAmount(STAmount const &amount, any_t const *)
AnyAmount & operator=(AnyAmount const &)=default
AnyAmount(AnyAmount const &)=default
ripple::Currency currency
BookSpec(AccountID const &account_, ripple::Currency const ¤cy_)
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...
PrettyAmount(PrettyAmount const &)=default
STAmount const & value() const
PrettyAmount(XRPAmount v)
drops
PrettyAmount(STAmount const &amount, std::string const &name)
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_integral_v< T > &&std::is_signed_v< T > > *=nullptr)
drops
std::string const & name() const
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_unsigned_v< T > > *=nullptr)
drops
PrettyAmount & operator=(PrettyAmount const &)=default
PrettyAmount operator()(Number v) const
Asset const & raw() const
PrettyAmount operator()(T v) const
None operator()(none_t) const
PrettyAsset(A const &asset, std::uint32_t scale=1)
PrettyAsset(Asset const &asset, std::uint32_t scale=1)
friend BookSpec operator~(XRP_t const &)
None operator()(none_t) const
Returns None-of-XRP.
PrettyAmount operator()(double v) const
PrettyAmount operator()(T v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertable to STAmount.
AnyAmount operator()(STAmount const &sta) const
detail::epsilon_multiple operator()(std::size_t n) const