1#include <xrpl/basics/Log.h>
2#include <xrpl/ledger/helpers/RippleStateHelpers.h>
3#include <xrpl/protocol/IOUAmount.h>
4#include <xrpl/protocol/XRPAmount.h>
5#include <xrpl/tx/paths/Flow.h>
6#include <xrpl/tx/paths/detail/AmountSpec.h>
7#include <xrpl/tx/paths/detail/Steps.h>
8#include <xrpl/tx/paths/detail/StrandFlow.h>
9#include <xrpl/tx/transactors/dex/AMMContext.h>
13template <
class FlowResult>
34path::RippleCalc::Output
43 bool ownerPaysTransferFee,
51 Issue const srcIssue = [&] {
53 return sendMax->issue();
63 sendMaxIssue = sendMax->issue();
96 j.
trace() <<
"\nsrc: " << src <<
"\ndst: " << dst <<
"\nsrcIssue: " << srcIssue
97 <<
"\ndstIssue: " << dstIssue;
98 j.
trace() <<
"\nNumStrands: " << strands.size();
99 for (
auto const& curStrand : strands)
101 j.
trace() <<
"NumSteps: " << curStrand.size();
102 for (
auto const& step : curStrand)
104 j.
trace() <<
'\n' << *step <<
'\n';
117 if (srcIsXRP && dstIsXRP)
123 flow<XRPAmount, XRPAmount>(
136 if (srcIsXRP && !dstIsXRP)
142 flow<XRPAmount, IOUAmount>(
155 if (!srcIsXRP && dstIsXRP)
161 flow<IOUAmount, XRPAmount>(
174 XRPL_ASSERT(!srcIsXRP && !dstIsXRP,
"xrpl::flow : neither is XRP");
179 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.
std::pair< TER, std::vector< Strand > > toStrands(ReadView const &sb, 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)
bool isXRP(AccountID const &c)
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.
bool isTesSuccess(TER x) noexcept
AmountSpec toAmountSpec(STAmount const &amt)
void setResult(TER const value)
boost::container::flat_set< uint256 > removableOffers