1#ifndef XRPL_PROTOCOL_ASSET_H_INCLUDED
2#define XRPL_PROTOCOL_ASSET_H_INCLUDED
4#include <xrpl/basics/Number.h>
5#include <xrpl/basics/base_uint.h>
6#include <xrpl/protocol/Issue.h>
7#include <xrpl/protocol/MPTIssue.h>
14template <
typename TIss>
57 template <Val
idIssueType TIss>
61 template <Val
idIssueType TIss>
65 template <Val
idIssueType TIss>
87 return issue.native();
100 return issue.native();
107 friend constexpr bool
113 friend constexpr bool
119 friend constexpr bool
131template <Val
idIssueType TIss>
138template <Val
idIssueType TIss>
143 Throw<std::logic_error>(
"Asset is not a requested issue");
147template <Val
idIssueType TIss>
152 Throw<std::logic_error>(
"Asset is not a requested issue");
166 [&]<
typename TLhs,
typename TRhs>(
167 TLhs
const& issLhs, TRhs
const& issRhs) {
169 return issLhs == issRhs;
182 TLhs
const& lhs_, TRhs
const& rhs_) {
187 return std::weak_ordering::greater;
189 return std::weak_ordering::less;
205 [&]<
typename TLhs,
typename TRhs>(
206 TLhs
const& issLhs, TRhs
const& issRhs) {
209 return issLhs.currency == issRhs.currency;
213 return issLhs.getMptID() == issRhs.getMptID();
constexpr TIss const & get() const
STAmount operator()(Number const &) const
std::string getText() const
Asset(Issue const &issue)
Conversions to Asset are implicit and conversions to specific issue type are explicit.
AccountID const & getIssuer() const
friend constexpr std::weak_ordering operator<=>(Asset const &lhs, Asset const &rhs)
friend constexpr bool equalTokens(Asset const &lhs, Asset const &rhs)
Return true if both assets refer to the same currency (regardless of issuer) or MPT issuance.
void setJson(Json::Value &jv) const
Asset(MPTID const &issuanceID)
constexpr bool holds() const
Asset(MPTIssue const &mptIssue)
friend constexpr bool operator==(Asset const &lhs, Asset const &rhs)
constexpr value_type const & value() const
A currency issued by an account.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool isXRP(AccountID const &c)
bool validJSONAsset(Json::Value const &jv)
std::string to_string(base_uint< Bits, Tag > const &a)
constexpr bool operator==(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
constexpr std::strong_ordering operator<=>(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
Asset assetFromJson(Json::Value const &jv)
Json::Value to_json(Asset const &asset)
constexpr bool equalTokens(Asset const &lhs, Asset const &rhs)