20 #include <ripple/app/paths/AMMContext.h>
21 #include <ripple/app/paths/Credit.h>
22 #include <ripple/app/paths/Flow.h>
23 #include <ripple/app/paths/impl/AmountSpec.h>
24 #include <ripple/app/paths/impl/Steps.h>
25 #include <ripple/app/paths/impl/StrandFlow.h>
26 #include <ripple/basics/IOUAmount.h>
27 #include <ripple/basics/Log.h>
28 #include <ripple/basics/XRPAmount.h>
30 #include <boost/container/flat_set.hpp>
37 template <
class FlowResult>
41 Issue const& srcIssue,
42 Issue const& dstIssue,
58 path::RippleCalc::Output
67 bool ownerPaysTransferFee,
74 Issue const srcIssue = [&] {
76 return sendMax->issue();
86 sendMaxIssue = sendMax->issue();
102 ownerPaysTransferFee,
118 j.
trace() <<
"\nsrc: " << src <<
"\ndst: " << dst
119 <<
"\nsrcIssue: " << srcIssue <<
"\ndstIssue: " << dstIssue;
120 j.
trace() <<
"\nNumStrands: " << strands.size();
121 for (
auto const& curStrand : strands)
123 j.
trace() <<
"NumSteps: " << curStrand.size();
124 for (
auto const& step : curStrand)
126 j.
trace() <<
'\n' << *step <<
'\n';
139 if (srcIsXRP && dstIsXRP)
145 flow<XRPAmount, XRPAmount>(
158 if (srcIsXRP && !dstIsXRP)
164 flow<XRPAmount, IOUAmount>(
177 if (!srcIsXRP && dstIsXRP)
183 flow<IOUAmount, XRPAmount>(
196 assert(!srcIsXRP && !dstIsXRP);
201 flow<IOUAmount, IOUAmount>(
A currency issued by an account.
Stream trace() const
Severity stream access functions.
Issue const & issue() const
A wrapper which makes credits unavailable to balances.
static auto finishFlow(PaymentSandbox &sb, Issue const &srcIssue, Issue const &dstIssue, FlowResult &&f)
boost::container::flat_set< uint256 > removableOffers
Integers of any length that is a multiple of 32-bits.
AmountSpec toAmountSpec(STAmount const &amt)
Maintains AMM info per overall payment engine execution and individual iteration.
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
path::RippleCalc::Output flow(PaymentSandbox &sb, STAmount const &deliver, AccountID const &src, AccountID const &dst, STPathSet const &paths, bool defaultPaths, bool partialPayment, bool ownerPaysTransferFee, bool offerCrossing, std::optional< Quality > const &limitQuality, std::optional< STAmount > const &sendMax, beast::Journal j, path::detail::FlowDebugInfo *flowDebugInfo)
Make a payment from the src account to the dst account.
std::pair< TER, std::vector< Strand > > toStrands(ReadView const &view, AccountID const &src, AccountID const &dst, Issue const &deliver, std::optional< Quality > const &limitQuality, std::optional< Issue > const &sendMax, STPathSet const &paths, bool addDefaultPath, bool ownerPaysTransferFee, bool offerCrossing, AMMContext &ammContext, beast::Journal j)
Create a Strand for each specified path (including the default path, if indicated)
bool isXRP(AccountID const &c)
A generic endpoint for log messages.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
void setResult(TER const value)
void setMultiPath(bool fs)