1#include <xrpld/app/paths/AMMContext.h>
2#include <xrpld/app/paths/Flow.h>
3#include <xrpld/app/paths/detail/AmountSpec.h>
4#include <xrpld/app/paths/detail/Steps.h>
5#include <xrpld/app/paths/detail/StrandFlow.h>
7#include <xrpl/basics/Log.h>
8#include <xrpl/ledger/Credit.h>
9#include <xrpl/protocol/IOUAmount.h>
10#include <xrpl/protocol/XRPAmount.h>
14template <
class FlowResult>
31path::RippleCalc::Output
40 bool ownerPaysTransferFee,
48 Issue const srcIssue = [&] {
50 return sendMax->issue();
60 sendMaxIssue = sendMax->issue();
93 j.
trace() <<
"\nsrc: " << src <<
"\ndst: " << dst <<
"\nsrcIssue: " << srcIssue <<
"\ndstIssue: " << dstIssue;
94 j.
trace() <<
"\nNumStrands: " << strands.size();
95 for (
auto const& curStrand : strands)
97 j.
trace() <<
"NumSteps: " << curStrand.size();
98 for (
auto const& step : curStrand)
100 j.
trace() <<
'\n' << *step <<
'\n';
113 if (srcIsXRP && dstIsXRP)
119 flow<XRPAmount, XRPAmount>(
132 if (srcIsXRP && !dstIsXRP)
138 flow<XRPAmount, IOUAmount>(
151 if (!srcIsXRP && dstIsXRP)
157 flow<IOUAmount, XRPAmount>(
170 XRPL_ASSERT(!srcIsXRP && !dstIsXRP,
"xrpl::flow : neither is XRP");
175 flow<IOUAmount, IOUAmount>(
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
Maintains AMM info per overall payment engine execution and individual iteration.
void setMultiPath(bool fs)
A currency issued by an account.
A wrapper which makes credits unavailable to balances.
Issue const & issue() const
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)
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, OfferCrossing offerCrossing, AMMContext &ammContext, std::optional< uint256 > const &domainID, beast::Journal j)
Create a Strand for each specified path (including the default path, if indicated)
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
static auto finishFlow(PaymentSandbox &sb, Issue const &srcIssue, Issue const &dstIssue, FlowResult &&f)
StrandResult< TInAmt, TOutAmt > flow(PaymentSandbox const &baseView, Strand const &strand, std::optional< TInAmt > const &maxIn, TOutAmt const &out, beast::Journal j)
Request out amount from a strand.
AmountSpec toAmountSpec(STAmount const &amt)
void setResult(TER const value)
boost::container::flat_set< uint256 > removableOffers