xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
rpc
detail
PathfinderUtils.h
1
#pragma once
2
3
#include <xrpl/protocol/Issue.h>
4
#include <xrpl/protocol/MPTIssue.h>
5
#include <xrpl/protocol/Protocol.h>
6
#include <xrpl/protocol/STAmount.h>
7
#include <xrpl/protocol/SystemParameters.h>
8
9
namespace
xrpl
{
10
11
inline
STAmount
12
largestAmount
(
STAmount
const
& amt)
13
{
14
return
amt.
asset
().
visit
(
15
[&](
Issue
const
& issue) ->
STAmount
{
16
if
(issue.
native
())
17
return
kInitialXrp
;
18
return
STAmount
(amt.
asset
(),
STAmount::kMaxValue
,
STAmount::kMaxOffset
);
19
},
20
[&](
MPTIssue
const
&) {
return
STAmount
(amt.
asset
(),
kMaxMpTokenAmount
, 0); });
21
}
22
23
inline
STAmount
24
convertAmount
(
STAmount
const
& amt,
bool
all)
25
{
26
if
(!all)
27
return
amt;
28
29
return
largestAmount
(amt);
30
};
31
32
inline
bool
33
convertAllCheck
(
STAmount
const
& a)
34
{
35
return
a ==
largestAmount
(a);
36
}
37
38
}
// namespace xrpl
xrpl::Asset::visit
constexpr auto visit(Visitors &&... visitors) const -> decltype(auto)
Definition
Asset.h:117
xrpl::Issue
A currency issued by an account.
Definition
Issue.h:18
xrpl::Issue::native
bool native() const
Definition
Issue.cpp:54
xrpl::MPTIssue
Definition
MPTIssue.h:23
xrpl::STAmount
Definition
STAmount.h:46
xrpl::STAmount::asset
Asset const & asset() const
Definition
STAmount.h:496
xrpl::STAmount::kMaxValue
static constexpr std::uint64_t kMaxValue
Definition
STAmount.h:67
xrpl::STAmount::kMaxOffset
static constexpr int kMaxOffset
Definition
STAmount.h:62
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::convertAmount
STAmount convertAmount(STAmount const &amt, bool all)
Definition
PathfinderUtils.h:24
xrpl::largestAmount
STAmount largestAmount(STAmount const &amt)
Definition
PathfinderUtils.h:12
xrpl::convertAllCheck
bool convertAllCheck(STAmount const &a)
Definition
PathfinderUtils.h:33
xrpl::kMaxMpTokenAmount
constexpr std::uint64_t kMaxMpTokenAmount
The maximum amount of MPTokenIssuance.
Definition
Protocol.h:297
xrpl::kInitialXrp
constexpr XRPAmount kInitialXrp
Configure the native currency.
Definition
SystemParameters.h:31
Generated by
1.17.0