1#include <xrpld/app/misc/AMMUtils.h>
2#include <xrpld/app/paths/AMMLiquidity.h>
3#include <xrpld/app/paths/AMMOffer.h>
4#include <xrpld/app/paths/detail/FlatSets.h>
5#include <xrpld/app/paths/detail/Steps.h>
6#include <xrpld/app/tx/detail/OfferStream.h>
8#include <xrpl/basics/Log.h>
9#include <xrpl/basics/contract.h>
10#include <xrpl/beast/utility/instrumentation.h>
11#include <xrpl/ledger/PaymentSandbox.h>
12#include <xrpl/protocol/Book.h>
13#include <xrpl/protocol/Feature.h>
14#include <xrpl/protocol/IOUAmount.h>
15#include <xrpl/protocol/Quality.h>
16#include <xrpl/protocol/XRPAmount.h>
18#include <boost/container/flat_set.hpp>
25template <
class TIn,
class TOut,
class TDerived>
26class BookStep :
public StepImp<TIn, TOut, BookStep<TIn, TOut, TDerived>>
59 Cache(TIn
const& in_, TOut
const& out_) :
in(in_),
out(out_)
76 ammSle && ammSle->getFieldAmount(sfLPTokenBalance) != beast::zero)
136 boost::container::flat_set<uint256>& ofrsToRm,
143 boost::container::flat_set<uint256>& ofrsToRm,
183 return !(lhs == rhs);
194 template <
class Callback>
200 Callback& callback)
const;
203 template <
template <
typename,
typename>
typename Offer>
208 TAmounts<TIn, TOut>
const& ofrAmt,
209 TAmounts<TIn, TOut>
const& stepAmt,
210 TOut
const& ownerGives)
const;
243template <
class TIn,
class TOut>
254 template <
template <
typename,
typename>
typename Offer>
341template <
class TIn,
class TOut>
343 :
public BookStep<TIn, TOut, BookOfferCrossingStep<TIn, TOut>>
359 "ripple::BookOfferCrossingStep::getQuality : nonzero quality");
361 Throw<FlowException>(
tefINTERNAL,
"Offer requires quality.");
362 return *limitQuality;
376 template <
template <
typename,
typename>
typename Offer>
384 bool const offerAttempted)
const
416 strandSrc == offer.owner() && strandDst == offer.owner())
419 if (
auto const key = offer.
key())
420 offers.permRmOffer(*key);
464 Step const* prevStep,
471 return owner == srcAcct
479 Step const* prevStep,
498 Rules const& rules)
const
510 if (!rules.
enabled(fixAMMv1_1))
513 offerType == OfferType::CLOB ||
545template <
class TIn,
class TOut,
class TDerived>
550 return book_ == bs->book_;
554template <
class TIn,
class TOut,
class TDerived>
570 Quality
const q =
static_cast<TDerived const*
>(
this)->adjustQualityWithFees(
580template <
class TIn,
class TOut,
class TDerived>
597 static_cast<TDerived const*
>(
this)->adjustQualityWithFees(
612 Quality
const q =
static_cast<TDerived const*
>(
this)->adjustQualityWithFees(
622template <
class TIn,
class TOut,
class TDerived>
630template <
class TIn,
class TOut,
class Offer>
634 TAmounts<TIn, TOut>& ofrAmt,
635 TAmounts<TIn, TOut>& stpAmt,
641 if (limit < stpAmt.in)
645 mulRatio(stpAmt.in, QUALITY_ONE, transferRateIn,
false);
653 ofrAmt = offer.limitIn(ofrAmt, inLmt,
false);
654 stpAmt.out = ofrAmt.out;
656 ofrAmt.out, transferRateOut, QUALITY_ONE,
false);
661template <
class TIn,
class TOut,
class Offer>
665 TAmounts<TIn, TOut>& ofrAmt,
666 TAmounts<TIn, TOut>& stpAmt,
672 if (limit < stpAmt.out)
676 stpAmt.out, transferRateOut, QUALITY_ONE,
false);
677 ofrAmt = offer.limitOut(
682 mulRatio(ofrAmt.in, transferRateIn, QUALITY_ONE,
true);
686template <
class TIn,
class TOut,
class TDerived>
687template <
class Callback>
693 Callback& callback)
const
701 if (
isXRP(
id) ||
id == this->strandDst_)
707 redeems(prevStepDir) ? rate(book_.in.account) : QUALITY_ONE;
710 ownerPaysTransferFee_ ? rate(book_.out.account) : QUALITY_ONE;
713 MaxOffersToConsume, j_);
718 bool offerAttempted =
false;
720 auto execOffer = [&](
auto& offer) {
724 ofrQ = offer.quality();
725 else if (*ofrQ != offer.quality())
728 if (
static_cast<TDerived const*
>(
this)->limitSelfCrossQuality(
729 strandSrc_, strandDst_, offer, ofrQ, offers, offerAttempted))
734 if (!
isXRP(offer.issueIn().currency) &&
735 offer.owner() != offer.issueIn().account)
737 auto const& issuerID = offer.issueIn().account;
742 auto const& ownerID = offer.owner();
743 auto const authFlag =
746 auto const line = afView.
read(
747 keylet::line(ownerID, issuerID, offer.issueIn().currency));
749 if (!line || (((*line)[sfFlags] & authFlag) == 0))
753 if (
auto const key = offer.
key())
754 offers.permRmOffer(*key);
764 if (!
static_cast<TDerived const*
>(
this)->checkQualityThreshold(
768 auto const [ofrInRate, ofrOutRate] = offer.adjustRates(
769 static_cast<TDerived const*
>(
this)->getOfrInRate(
770 prevStep_, offer.owner(), trIn),
771 static_cast<TDerived const*
>(
this)->getOfrOutRate(
772 prevStep_, offer.owner(), strandDst_, trOut));
774 auto ofrAmt = offer.amount();
776 mulRatio(ofrAmt.in, ofrInRate, QUALITY_ONE,
true),
781 mulRatio(ofrAmt.out, ofrOutRate, QUALITY_ONE,
false);
783 auto const funds = offer.isFunded()
785 : offers.ownerFunds();
788 if (funds < ownerGives)
793 ownerGives, QUALITY_ONE, ofrOutRate,
false);
798 ofrAmt = offer.limitOut(ofrAmt, stpAmt.out,
false);
801 mulRatio(ofrAmt.in, ofrInRate, QUALITY_ONE,
true);
804 offerAttempted =
true;
806 offer, ofrAmt, stpAmt, ownerGives, ofrInRate, ofrOutRate);
819 return static_cast<TDerived const*
>(
this)->qualityThreshold(
823 auto ammOffer = getAMMOffer(sb, qualityThreshold);
824 return !ammOffer || execOffer(*ammOffer);
829 if (tryAMM(offers.tip().quality()))
833 if (!execOffer(offers.tip()))
835 }
while (offers.step());
844 return {offers.permToRemove(), counter.
count()};
847template <
class TIn,
class TOut,
class TDerived>
848template <
template <
typename,
typename>
typename Offer>
853 TAmounts<TIn, TOut>
const& ofrAmt,
854 TAmounts<TIn, TOut>
const& stepAmt,
855 TOut
const& ownerGives)
const
857 if (!offer.checkInvariant(ofrAmt, j_))
863 Throw<FlowException>(
871 auto const dr = offer.send(
878 Throw<FlowException>(dr);
884 auto const cr = offer.send(
891 Throw<FlowException>(cr);
894 offer.consume(sb, ofrAmt);
897template <
class TIn,
class TOut,
class TDerived>
904 return ammLiquidity_->getOffer(view, clobQuality);
908template <
class TIn,
class TOut,
class TDerived>
915 auto const lobQuality =
936 return static_cast<TDerived const*
>(
this)->qualityThreshold(
941 if (
auto const ammOffer = getAMMOffer(view, qualityThreshold); ammOffer &&
942 ((lobQuality && ammOffer->quality() > lobQuality) || !lobQuality))
948template <
class TIn,
class TOut,
class TDerived>
953 if (
auto const res = tip(view); !res)
962template <
class TIn,
class TOut,
class TDerived>
966 if (
auto const res = tip(view); !res)
974template <
class TCollection>
976sum(TCollection
const& col)
980 return TResult{beast::zero};
984template <
class TIn,
class TOut,
class TDerived>
989 boost::container::flat_set<uint256>& ofrsToRm,
994 TAmounts<TIn, TOut> result(beast::zero, beast::zero);
996 auto remainingOut =
out;
998 boost::container::flat_multiset<TIn> savedIns;
999 savedIns.reserve(64);
1000 boost::container::flat_multiset<TOut> savedOuts;
1001 savedOuts.reserve(64);
1007 auto eachOffer = [&](
auto& offer,
1008 TAmounts<TIn, TOut>
const& ofrAmt,
1009 TAmounts<TIn, TOut>
const& stpAmt,
1010 TOut
const& ownerGives,
1013 if (remainingOut <= beast::zero)
1016 if (stpAmt.out <= remainingOut)
1018 savedIns.insert(stpAmt.in);
1019 savedOuts.insert(stpAmt.out);
1020 result = TAmounts<TIn, TOut>(
sum(savedIns),
sum(savedOuts));
1021 remainingOut =
out - result.out;
1022 this->consumeOffer(sb, offer, ofrAmt, stpAmt, ownerGives);
1029 auto ofrAdjAmt = ofrAmt;
1030 auto stpAdjAmt = stpAmt;
1031 auto ownerGivesAdj = ownerGives;
1040 remainingOut = beast::zero;
1041 savedIns.insert(stpAdjAmt.in);
1042 savedOuts.insert(remainingOut);
1043 result.in =
sum(savedIns);
1045 this->consumeOffer(sb, offer, ofrAdjAmt, stpAdjAmt, ownerGivesAdj);
1052 return offer.fully_consumed();
1057 auto const prevStepDebtDir = [&] {
1062 auto const r = forEachOffer(sb, afView, prevStepDebtDir, eachOffer);
1063 boost::container::flat_set<uint256> toRm = std::move(
std::get<0>(r));
1065 offersUsed_ = offersConsumed;
1069 if (offersConsumed >= MaxOffersToConsume)
1075 switch (remainingOut.signum())
1081 <<
"BookStep remainingOut < 0 " <<
to_string(remainingOut);
1082 UNREACHABLE(
"ripple::BookStep::revImp : remaining less than zero");
1083 cache_.emplace(beast::zero, beast::zero);
1084 return {beast::zero, beast::zero};
1094 cache_.emplace(result.in, result.out);
1095 return {result.in, result.out};
1098template <
class TIn,
class TOut,
class TDerived>
1103 boost::container::flat_set<uint256>& ofrsToRm,
1106 XRPL_ASSERT(cache_,
"ripple::BookStep::fwdImp : cache is set");
1108 TAmounts<TIn, TOut> result(beast::zero, beast::zero);
1110 auto remainingIn =
in;
1112 boost::container::flat_multiset<TIn> savedIns;
1113 savedIns.reserve(64);
1114 boost::container::flat_multiset<TOut> savedOuts;
1115 savedOuts.reserve(64);
1119 auto eachOffer = [&](
auto& offer,
1120 TAmounts<TIn, TOut>
const& ofrAmt,
1121 TAmounts<TIn, TOut>
const& stpAmt,
1122 TOut
const& ownerGives,
1126 cache_,
"ripple::BookStep::fwdImp::eachOffer : cache is set");
1128 if (remainingIn <= beast::zero)
1131 bool processMore =
true;
1132 auto ofrAdjAmt = ofrAmt;
1133 auto stpAdjAmt = stpAmt;
1134 auto ownerGivesAdj = ownerGives;
1136 typename boost::container::flat_multiset<TOut>::const_iterator lastOut;
1137 if (stpAmt.in <= remainingIn)
1139 savedIns.insert(stpAmt.in);
1140 lastOut = savedOuts.insert(stpAmt.out);
1141 result = TAmounts<TIn, TOut>(
sum(savedIns),
sum(savedOuts));
1155 savedIns.insert(remainingIn);
1156 lastOut = savedOuts.insert(stpAdjAmt.out);
1157 result.out =
sum(savedOuts);
1160 processMore =
false;
1163 if (result.out > cache_->out && result.in <= cache_->in)
1172 auto const lastOutAmt = *lastOut;
1173 savedOuts.erase(lastOut);
1174 auto const remainingOut = cache_->out -
sum(savedOuts);
1175 auto ofrAdjAmtRev = ofrAmt;
1176 auto stpAdjAmtRev = stpAmt;
1177 auto ownerGivesAdjRev = ownerGives;
1187 if (stpAdjAmtRev.in == remainingIn)
1190 result.out = cache_->out;
1193 savedIns.insert(result.in);
1195 savedOuts.insert(result.out);
1197 ofrAdjAmt = ofrAdjAmtRev;
1198 stpAdjAmt.in = remainingIn;
1199 stpAdjAmt.out = remainingOut;
1200 ownerGivesAdj = ownerGivesAdjRev;
1206 savedOuts.insert(lastOutAmt);
1210 remainingIn =
in - result.in;
1211 this->consumeOffer(sb, offer, ofrAdjAmt, stpAdjAmt, ownerGivesAdj);
1217 return processMore || offer.fully_consumed();
1221 auto const prevStepDebtDir = [&] {
1226 auto const r = forEachOffer(sb, afView, prevStepDebtDir, eachOffer);
1227 boost::container::flat_set<uint256> toRm = std::move(
std::get<0>(r));
1229 offersUsed_ = offersConsumed;
1233 if (offersConsumed >= MaxOffersToConsume)
1239 switch (remainingIn.signum())
1245 <<
"BookStep remainingIn < 0 " <<
to_string(remainingIn);
1246 UNREACHABLE(
"ripple::BookStep::fwdImp : remaining less than zero");
1247 cache_.emplace(beast::zero, beast::zero);
1248 return {beast::zero, beast::zero};
1258 cache_.emplace(result.in, result.out);
1259 return {result.in, result.out};
1262template <
class TIn,
class TOut,
class TDerived>
1271 JLOG(j_.
trace()) <<
"Expected valid cache in validFwd";
1275 auto const savCache = *cache_;
1279 boost::container::flat_set<uint256> dummy;
1280 fwdImp(sb, afView, dummy, get<TIn>(
in));
1282 catch (FlowException
const&)
1287 if (!(
checkNear(savCache.in, cache_->in) &&
1290 JLOG(j_.
warn()) <<
"Strand re-execute check failed."
1291 <<
" ExpectedIn: " <<
to_string(savCache.in)
1292 <<
" CachedIn: " <<
to_string(cache_->in)
1293 <<
" ExpectedOut: " <<
to_string(savCache.out)
1294 <<
" CachedOut: " <<
to_string(cache_->out);
1300template <
class TIn,
class TOut,
class TDerived>
1304 if (book_.in == book_.out)
1306 JLOG(j_.
debug()) <<
"BookStep: Book with same in and out issuer "
1312 JLOG(j_.
debug()) <<
"Book: currency is inconsistent with issuer."
1322 JLOG(j_.
debug()) <<
"BookStep: loop detected: " << *
this;
1328 JLOG(j_.
debug()) <<
"BookStep: loop detected: " << *
this;
1332 auto issuerExists = [](
ReadView const& view,
Issue const& iss) ->
bool {
1336 if (!issuerExists(ctx.
view, book_.in) || !issuerExists(ctx.
view, book_.out))
1338 JLOG(j_.
debug()) <<
"BookStep: deleted issuer detected: " << *
this;
1346 auto const& view = ctx.
view;
1347 auto const& cur = book_.in.account;
1352 if ((*sle)[sfFlags] &
1366template <
class TIn,
class TOut,
class TDerived>
1371 return book == bs->book();
1380 if (inXRP && outXRP)
1383 UNREACHABLE(
"ripple::test::bookStepEqual : no XRP to XRP book step");
1387 if (inXRP && !outXRP)
1392 if (!inXRP && outXRP)
1397 if (!inXRP && !outXRP)
1408template <
class TIn,
class TOut>
1416 auto offerCrossingStep =
1418 ter = offerCrossingStep->check(ctx);
1419 r = std::move(offerCrossingStep);
1425 ter = paymentStep->check(ctx);
1426 r = std::move(paymentStep);
1429 return {ter,
nullptr};
1437 return make_BookStepHelper<IOUAmount, IOUAmount>(ctx,
in,
out);
1443 return make_BookStepHelper<IOUAmount, XRPAmount>(ctx,
in,
xrpIssue());
1449 return make_BookStepHelper<XRPAmount, IOUAmount>(ctx,
xrpIssue(),
out);
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
AccountID account() const
Represents synthetic AMM offer in BookStep.
Quality quality() const noexcept
Writeable view to a ledger, for applying a transaction.
std::uint32_t getOfrInRate(Step const *prevStep, AccountID const &owner, std::uint32_t trIn) const
static Quality getQuality(std::optional< Quality > const &limitQuality)
BookOfferCrossingStep(StrandContext const &ctx, Issue const &in, Issue const &out)
bool checkQualityThreshold(Quality const &quality) const
std::string logString() const override
std::uint32_t getOfrOutRate(Step const *prevStep, AccountID const &owner, AccountID const &strandDst, std::uint32_t trOut) const
bool limitSelfCrossQuality(AccountID const &strandSrc, AccountID const &strandDst, Offer< TIn, TOut > const &offer, std::optional< Quality > &ofrQ, FlowOfferStream< TIn, TOut > &offers, bool const offerAttempted) const
Quality const qualityThreshold_
std::optional< Quality > qualityThreshold(Quality const &lobQuality) const
Quality adjustQualityWithFees(ReadView const &v, Quality const &ofrQ, DebtDirection prevStepDir, WaiveTransferFee waiveFee, OfferType offerType, Rules const &rules) const
bool limitSelfCrossQuality(AccountID const &, AccountID const &, Offer< TIn, TOut > const &offer, std::optional< Quality > &, FlowOfferStream< TIn, TOut > &, bool) const
Quality adjustQualityWithFees(ReadView const &v, Quality const &ofrQ, DebtDirection prevStepDir, WaiveTransferFee waiveFee, OfferType, Rules const &) const
std::uint32_t getOfrOutRate(Step const *, AccountID const &, AccountID const &, std::uint32_t trOut) const
BookPaymentStep()=default
std::uint32_t getOfrInRate(Step const *, AccountID const &, std::uint32_t trIn) const
bool checkQualityThreshold(Quality const &quality) const
std::optional< Quality > qualityThreshold(Quality const &lobQuality) const
std::string logString() const override
std::optional< AMMOffer< TIn, TOut > > getAMMOffer(ReadView const &view, std::optional< Quality > const &clobQuality) const
std::optional< AMMLiquidity< TIn, TOut > > ammLiquidity_
friend bool operator==(BookStep const &lhs, BookStep const &rhs)
std::uint32_t offersUsed() const override
std::optional< Book > bookStepBook() const override
std::uint32_t offersUsed_
Number of offers consumed or partially consumed the last time the step ran, including expired and unf...
std::optional< EitherAmount > cachedOut() const override
std::optional< std::pair< Quality, OfferType > > tipOfferQuality(ReadView const &view) const
void consumeOffer(PaymentSandbox &sb, Offer< TIn, TOut > &offer, TAmounts< TIn, TOut > const &ofrAmt, TAmounts< TIn, TOut > const &stepAmt, TOut const &ownerGives) const
std::pair< std::optional< QualityFunction >, DebtDirection > getQualityFunc(ReadView const &v, DebtDirection prevStepDir) const override
TER check(StrandContext const &ctx) const
std::pair< boost::container::flat_set< uint256 >, std::uint32_t > forEachOffer(PaymentSandbox &sb, ApplyView &afView, DebtDirection prevStepDebtDir, Callback &callback) const
std::pair< bool, EitherAmount > validFwd(PaymentSandbox &sb, ApplyView &afView, EitherAmount const &in) override
Book const & book() const
std::optional< EitherAmount > cachedIn() const override
bool equal(Step const &rhs) const override
DebtDirection debtDirection(ReadView const &sb, StrandDirection dir) const override
std::pair< TIn, TOut > revImp(PaymentSandbox &sb, ApplyView &afView, boost::container::flat_set< uint256 > &ofrsToRm, TOut const &out)
static constexpr uint32_t MaxOffersToConsume
Step const *const prevStep_
friend bool operator!=(BookStep const &lhs, BookStep const &rhs)
std::string logStringImpl(char const *name) const
BookStep(StrandContext const &ctx, Issue const &in, Issue const &out)
std::pair< TIn, TOut > fwdImp(PaymentSandbox &sb, ApplyView &afView, boost::container::flat_set< uint256 > &ofrsToRm, TIn const &in)
std::optional< QualityFunction > tipOfferQualityF(ReadView const &view) const
bool inactive() const override
std::optional< std::variant< Quality, AMMOffer< TIn, TOut > > > tip(ReadView const &view) const
std::pair< std::optional< Quality >, DebtDirection > qualityUpperBound(ReadView const &v, DebtDirection prevStepDir) const override
bool const ownerPaysTransferFee_
std::optional< Cache > cache_
Iterates and consumes raw offers in an order book.
bool step(beast::Journal j)
Erases the current offer and advance to the next offer.
Quality const & quality() const noexcept
Presents and consumes the offers in an order book.
Floating point representation of amounts with high dynamic range.
A currency issued by an account.
A wrapper which makes credits unavailable to balances.
Average quality of a path as a function of out: q(out) = m * out + b, where m = -1 / poolGets,...
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
NetClock::time_point parentCloseTime() const
Returns the close time of the previous ledger.
virtual Rules const & rules() const =0
Returns the tx processing rules.
Rules controlling protocol behavior.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
static std::uint64_t const uRateOne
Discardable, editable view to a ledger.
A step in a payment path.
virtual std::optional< Book > bookStepBook() const
If this step is a BookStep, return the book.
virtual std::optional< AccountID > directStepSrcAcct() const
If this step is DirectStepI (IOU->IOU direct step), return the src account.
std::uint32_t count() const
Rules const & rules() const override
Returns the tx processing rules.
Keylet amm(Asset const &issue1, Asset const &issue2) noexcept
AMM entry.
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
Keylet account(AccountID const &id) noexcept
AccountID root.
static bool equalHelper(Step const &step, ripple::Book const &book)
bool bookStepEqual(Step const &step, ripple::Book const &book)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
static auto sum(TCollection const &col)
bool isConsistent(Book const &book)
bool isXRP(AccountID const &c)
static void limitStepIn(Offer const &offer, TAmounts< TIn, TOut > &ofrAmt, TAmounts< TIn, TOut > &stpAmt, TOut &ownerGives, std::uint32_t transferRateIn, std::uint32_t transferRateOut, TIn const &limit)
std::uint16_t getTradingFee(ReadView const &view, SLE const &ammSle, AccountID const &account)
Get AMM trading fee for the given account.
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
static bool isDefaultPath(STPath const &path)
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
Quality composed_quality(Quality const &lhs, Quality const &rhs)
void SetUnion(boost::container::flat_set< T > &dst, boost::container::flat_set< T > const &src)
Given two flat sets dst and src, compute dst = dst union src.
std::pair< TER, std::unique_ptr< Step > > make_BookStepXI(StrandContext const &ctx, Issue const &out)
std::pair< TER, std::unique_ptr< Step > > make_BookStepIX(StrandContext const &ctx, Issue const &in)
bool checkNear(IOUAmount const &expected, IOUAmount const &actual)
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
static void limitStepOut(Offer const &offer, TAmounts< TIn, TOut > &ofrAmt, TAmounts< TIn, TOut > &stpAmt, TOut &ownerGives, std::uint32_t transferRateIn, std::uint32_t transferRateOut, TOut const &limit)
static std::pair< TER, std::unique_ptr< Step > > make_BookStepHelper(StrandContext const &ctx, Issue const &in, Issue const &out)
std::pair< TER, std::unique_ptr< Step > > make_BookStepII(StrandContext const &ctx, Issue const &in, Issue const &out)
IOUAmount mulRatio(IOUAmount const &amt, std::uint32_t num, std::uint32_t den, bool roundUp)
std::string to_string(base_uint< Bits, Tag > const &a)
Rate const parityRate
A transfer rate signifying a 1:1 exchange.
Cache(TIn const &in_, TOut const &out_)
Context needed to build Strand Steps and for error checking.
boost::container::flat_set< Issue > & seenBookOuts
A strand may not include an offer that output the same issue more than once.
ReadView const & view
Current ReadView.
std::array< boost::container::flat_set< Issue >, 2 > & seenDirectIssues
A strand may not include the same account node more than once in the same currency.
Step const *const prevStep
The previous step in the strand.
OfferCrossing const offerCrossing
Yes/Sell if offer crossing, not payment.