20#include <xrpld/app/misc/AMMUtils.h>
21#include <xrpld/app/paths/AMMLiquidity.h>
22#include <xrpld/app/paths/AMMOffer.h>
23#include <xrpld/app/paths/detail/FlatSets.h>
24#include <xrpld/app/paths/detail/Steps.h>
25#include <xrpld/app/tx/detail/OfferStream.h>
27#include <xrpl/basics/Log.h>
28#include <xrpl/basics/contract.h>
29#include <xrpl/beast/utility/instrumentation.h>
30#include <xrpl/ledger/PaymentSandbox.h>
31#include <xrpl/protocol/Book.h>
32#include <xrpl/protocol/Feature.h>
33#include <xrpl/protocol/IOUAmount.h>
34#include <xrpl/protocol/Quality.h>
35#include <xrpl/protocol/XRPAmount.h>
37#include <boost/container/flat_set.hpp>
44template <
class TIn,
class TOut,
class TDerived>
45class BookStep :
public StepImp<TIn, TOut, BookStep<TIn, TOut, TDerived>>
78 Cache(TIn
const& in_, TOut
const& out_) :
in(in_),
out(out_)
104 ammSle && ammSle->getFieldAmount(sfLPTokenBalance) != beast::zero)
107 (*ammSle)[sfAccount],
164 boost::container::flat_set<uint256>& ofrsToRm,
171 boost::container::flat_set<uint256>& ofrsToRm,
211 return !(lhs == rhs);
222 template <
class Callback>
228 Callback& callback)
const;
231 template <
template <
typename,
typename>
typename Offer>
236 TAmounts<TIn, TOut>
const& ofrAmt,
237 TAmounts<TIn, TOut>
const& stepAmt,
238 TOut
const& ownerGives)
const;
271template <
class TIn,
class TOut>
282 template <
template <
typename,
typename>
typename Offer>
369template <
class TIn,
class TOut>
371 :
public BookStep<TIn, TOut, BookOfferCrossingStep<TIn, TOut>>
387 "ripple::BookOfferCrossingStep::getQuality : nonzero quality");
389 Throw<FlowException>(
tefINTERNAL,
"Offer requires quality.");
390 return *limitQuality;
404 template <
template <
typename,
typename>
typename Offer>
412 bool const offerAttempted)
const
444 strandSrc == offer.owner() && strandDst == offer.owner())
447 if (
auto const key = offer.
key())
448 offers.permRmOffer(*key);
492 Step const* prevStep,
499 return owner == srcAcct
507 Step const* prevStep,
526 Rules const& rules)
const
538 if (!rules.
enabled(fixAMMv1_1))
541 offerType == OfferType::CLOB ||
573template <
class TIn,
class TOut,
class TDerived>
578 return book_ == bs->book_;
582template <
class TIn,
class TOut,
class TDerived>
598 Quality
const q =
static_cast<TDerived const*
>(
this)->adjustQualityWithFees(
608template <
class TIn,
class TOut,
class TDerived>
625 static_cast<TDerived const*
>(
this)->adjustQualityWithFees(
640 Quality
const q =
static_cast<TDerived const*
>(
this)->adjustQualityWithFees(
650template <
class TIn,
class TOut,
class TDerived>
658template <
class TIn,
class TOut,
class Offer>
662 TAmounts<TIn, TOut>& ofrAmt,
663 TAmounts<TIn, TOut>& stpAmt,
669 if (limit < stpAmt.in)
673 mulRatio(stpAmt.in, QUALITY_ONE, transferRateIn,
false);
681 ofrAmt = offer.limitIn(ofrAmt, inLmt,
false);
682 stpAmt.out = ofrAmt.out;
684 ofrAmt.out, transferRateOut, QUALITY_ONE,
false);
689template <
class TIn,
class TOut,
class Offer>
693 TAmounts<TIn, TOut>& ofrAmt,
694 TAmounts<TIn, TOut>& stpAmt,
700 if (limit < stpAmt.out)
704 stpAmt.out, transferRateOut, QUALITY_ONE,
false);
705 ofrAmt = offer.limitOut(
710 mulRatio(ofrAmt.in, transferRateIn, QUALITY_ONE,
true);
714template <
class TIn,
class TOut,
class TDerived>
715template <
class Callback>
721 Callback& callback)
const
729 if (
isXRP(
id) ||
id == this->strandDst_)
735 redeems(prevStepDir) ? rate(book_.in.account) : QUALITY_ONE;
738 ownerPaysTransferFee_ ? rate(book_.out.account) : QUALITY_ONE;
741 maxOffersToConsume_, j_);
746 bool offerAttempted =
false;
748 auto execOffer = [&](
auto& offer) {
752 ofrQ = offer.quality();
753 else if (*ofrQ != offer.quality())
756 if (
static_cast<TDerived const*
>(
this)->limitSelfCrossQuality(
757 strandSrc_, strandDst_, offer, ofrQ, offers, offerAttempted))
762 if (!
isXRP(offer.issueIn().currency) &&
763 offer.owner() != offer.issueIn().account)
765 auto const& issuerID = offer.issueIn().account;
770 auto const& ownerID = offer.owner();
771 auto const authFlag =
774 auto const line = afView.
read(
775 keylet::line(ownerID, issuerID, offer.issueIn().currency));
777 if (!line || (((*line)[sfFlags] & authFlag) == 0))
781 if (
auto const key = offer.
key())
782 offers.permRmOffer(*key);
792 if (!
static_cast<TDerived const*
>(
this)->checkQualityThreshold(
796 auto const [ofrInRate, ofrOutRate] = offer.adjustRates(
797 static_cast<TDerived const*
>(
this)->getOfrInRate(
798 prevStep_, offer.owner(), trIn),
799 static_cast<TDerived const*
>(
this)->getOfrOutRate(
800 prevStep_, offer.owner(), strandDst_, trOut));
802 auto ofrAmt = offer.amount();
804 mulRatio(ofrAmt.in, ofrInRate, QUALITY_ONE,
true),
809 mulRatio(ofrAmt.out, ofrOutRate, QUALITY_ONE,
false);
811 auto const funds = offer.isFunded()
813 : offers.ownerFunds();
816 if (funds < ownerGives)
821 ownerGives, QUALITY_ONE, ofrOutRate,
false);
826 ofrAmt = offer.limitOut(ofrAmt, stpAmt.out,
false);
829 mulRatio(ofrAmt.in, ofrInRate, QUALITY_ONE,
true);
832 offerAttempted =
true;
834 offer, ofrAmt, stpAmt, ownerGives, ofrInRate, ofrOutRate);
847 return static_cast<TDerived const*
>(
this)->qualityThreshold(
851 auto ammOffer = getAMMOffer(sb, qualityThreshold);
852 return !ammOffer || execOffer(*ammOffer);
857 if (tryAMM(offers.tip().quality()))
861 if (!execOffer(offers.tip()))
863 }
while (offers.step());
872 return {offers.permToRemove(), counter.
count()};
875template <
class TIn,
class TOut,
class TDerived>
876template <
template <
typename,
typename>
typename Offer>
881 TAmounts<TIn, TOut>
const& ofrAmt,
882 TAmounts<TIn, TOut>
const& stepAmt,
883 TOut
const& ownerGives)
const
885 if (!offer.checkInvariant(ofrAmt, j_))
891 Throw<FlowException>(
899 auto const dr = offer.send(
906 Throw<FlowException>(dr);
912 auto const cr = offer.send(
919 Throw<FlowException>(cr);
922 offer.consume(sb, ofrAmt);
925template <
class TIn,
class TOut,
class TDerived>
932 return ammLiquidity_->getOffer(view, clobQuality);
936template <
class TIn,
class TOut,
class TDerived>
943 auto const lobQuality =
964 return static_cast<TDerived const*
>(
this)->qualityThreshold(
969 if (
auto const ammOffer = getAMMOffer(view, qualityThreshold); ammOffer &&
970 ((lobQuality && ammOffer->quality() > lobQuality) || !lobQuality))
976template <
class TIn,
class TOut,
class TDerived>
981 if (
auto const res = tip(view); !res)
990template <
class TIn,
class TOut,
class TDerived>
994 if (
auto const res = tip(view); !res)
1002template <
class TCollection>
1008 return TResult{beast::zero};
1012template <
class TIn,
class TOut,
class TDerived>
1017 boost::container::flat_set<uint256>& ofrsToRm,
1022 TAmounts<TIn, TOut> result(beast::zero, beast::zero);
1024 auto remainingOut =
out;
1026 boost::container::flat_multiset<TIn> savedIns;
1027 savedIns.reserve(64);
1028 boost::container::flat_multiset<TOut> savedOuts;
1029 savedOuts.reserve(64);
1035 auto eachOffer = [&](
auto& offer,
1036 TAmounts<TIn, TOut>
const& ofrAmt,
1037 TAmounts<TIn, TOut>
const& stpAmt,
1038 TOut
const& ownerGives,
1041 if (remainingOut <= beast::zero)
1044 if (stpAmt.out <= remainingOut)
1046 savedIns.insert(stpAmt.in);
1047 savedOuts.insert(stpAmt.out);
1048 result = TAmounts<TIn, TOut>(
sum(savedIns),
sum(savedOuts));
1049 remainingOut =
out - result.out;
1050 this->consumeOffer(sb, offer, ofrAmt, stpAmt, ownerGives);
1057 auto ofrAdjAmt = ofrAmt;
1058 auto stpAdjAmt = stpAmt;
1059 auto ownerGivesAdj = ownerGives;
1068 remainingOut = beast::zero;
1069 savedIns.insert(stpAdjAmt.in);
1070 savedOuts.insert(remainingOut);
1071 result.in =
sum(savedIns);
1073 this->consumeOffer(sb, offer, ofrAdjAmt, stpAdjAmt, ownerGivesAdj);
1080 return offer.fully_consumed();
1085 auto const prevStepDebtDir = [&] {
1090 auto const r = forEachOffer(sb, afView, prevStepDebtDir, eachOffer);
1091 boost::container::flat_set<uint256> toRm = std::move(
std::get<0>(r));
1093 offersUsed_ = offersConsumed;
1096 if (offersConsumed >= maxOffersToConsume_)
1102 cache_.emplace(beast::zero, beast::zero);
1103 return {beast::zero, beast::zero};
1112 switch (remainingOut.signum())
1117 <<
"BookStep remainingOut < 0 " <<
to_string(remainingOut);
1118 UNREACHABLE(
"ripple::BookStep::revImp : remaining less than zero");
1119 cache_.emplace(beast::zero, beast::zero);
1120 return {beast::zero, beast::zero};
1129 cache_.emplace(result.in, result.out);
1130 return {result.in, result.out};
1133template <
class TIn,
class TOut,
class TDerived>
1138 boost::container::flat_set<uint256>& ofrsToRm,
1141 XRPL_ASSERT(cache_,
"ripple::BookStep::fwdImp : cache is set");
1143 TAmounts<TIn, TOut> result(beast::zero, beast::zero);
1145 auto remainingIn =
in;
1147 boost::container::flat_multiset<TIn> savedIns;
1148 savedIns.reserve(64);
1149 boost::container::flat_multiset<TOut> savedOuts;
1150 savedOuts.reserve(64);
1154 auto eachOffer = [&](
auto& offer,
1155 TAmounts<TIn, TOut>
const& ofrAmt,
1156 TAmounts<TIn, TOut>
const& stpAmt,
1157 TOut
const& ownerGives,
1161 cache_,
"ripple::BookStep::fwdImp::eachOffer : cache is set");
1163 if (remainingIn <= beast::zero)
1166 bool processMore =
true;
1167 auto ofrAdjAmt = ofrAmt;
1168 auto stpAdjAmt = stpAmt;
1169 auto ownerGivesAdj = ownerGives;
1171 typename boost::container::flat_multiset<TOut>::const_iterator lastOut;
1172 if (stpAmt.in <= remainingIn)
1174 savedIns.insert(stpAmt.in);
1175 lastOut = savedOuts.insert(stpAmt.out);
1176 result = TAmounts<TIn, TOut>(
sum(savedIns),
sum(savedOuts));
1190 savedIns.insert(remainingIn);
1191 lastOut = savedOuts.insert(stpAdjAmt.out);
1192 result.out =
sum(savedOuts);
1195 processMore =
false;
1198 if (result.out > cache_->out && result.in <= cache_->in)
1207 auto const lastOutAmt = *lastOut;
1208 savedOuts.erase(lastOut);
1209 auto const remainingOut = cache_->out -
sum(savedOuts);
1210 auto ofrAdjAmtRev = ofrAmt;
1211 auto stpAdjAmtRev = stpAmt;
1212 auto ownerGivesAdjRev = ownerGives;
1222 if (stpAdjAmtRev.in == remainingIn)
1225 result.out = cache_->out;
1228 savedIns.insert(result.in);
1230 savedOuts.insert(result.out);
1232 ofrAdjAmt = ofrAdjAmtRev;
1233 stpAdjAmt.in = remainingIn;
1234 stpAdjAmt.out = remainingOut;
1235 ownerGivesAdj = ownerGivesAdjRev;
1241 savedOuts.insert(lastOutAmt);
1245 remainingIn =
in - result.in;
1246 this->consumeOffer(sb, offer, ofrAdjAmt, stpAdjAmt, ownerGivesAdj);
1252 return processMore || offer.fully_consumed();
1256 auto const prevStepDebtDir = [&] {
1261 auto const r = forEachOffer(sb, afView, prevStepDebtDir, eachOffer);
1262 boost::container::flat_set<uint256> toRm = std::move(
std::get<0>(r));
1264 offersUsed_ = offersConsumed;
1267 if (offersConsumed >= maxOffersToConsume_)
1273 cache_.emplace(beast::zero, beast::zero);
1274 return {beast::zero, beast::zero};
1283 switch (remainingIn.signum())
1288 <<
"BookStep remainingIn < 0 " <<
to_string(remainingIn);
1289 UNREACHABLE(
"ripple::BookStep::fwdImp : remaining less than zero");
1290 cache_.emplace(beast::zero, beast::zero);
1291 return {beast::zero, beast::zero};
1300 cache_.emplace(result.in, result.out);
1301 return {result.in, result.out};
1304template <
class TIn,
class TOut,
class TDerived>
1313 JLOG(j_.
trace()) <<
"Expected valid cache in validFwd";
1317 auto const savCache = *cache_;
1321 boost::container::flat_set<uint256> dummy;
1322 fwdImp(sb, afView, dummy, get<TIn>(
in));
1324 catch (FlowException
const&)
1329 if (!(
checkNear(savCache.in, cache_->in) &&
1332 JLOG(j_.
warn()) <<
"Strand re-execute check failed."
1333 <<
" ExpectedIn: " <<
to_string(savCache.in)
1334 <<
" CachedIn: " <<
to_string(cache_->in)
1335 <<
" ExpectedOut: " <<
to_string(savCache.out)
1336 <<
" CachedOut: " <<
to_string(cache_->out);
1342template <
class TIn,
class TOut,
class TDerived>
1346 if (book_.in == book_.out)
1348 JLOG(j_.
debug()) <<
"BookStep: Book with same in and out issuer "
1354 JLOG(j_.
debug()) <<
"Book: currency is inconsistent with issuer."
1364 JLOG(j_.
debug()) <<
"BookStep: loop detected: " << *
this;
1370 JLOG(j_.
debug()) <<
"BookStep: loop detected: " << *
this;
1374 auto issuerExists = [](
ReadView const& view,
Issue const& iss) ->
bool {
1378 if (!issuerExists(ctx.
view, book_.in) || !issuerExists(ctx.
view, book_.out))
1380 JLOG(j_.
debug()) <<
"BookStep: deleted issuer detected: " << *
this;
1388 auto const& view = ctx.
view;
1389 auto const& cur = book_.in.account;
1394 if ((*sle)[sfFlags] &
1408template <
class TIn,
class TOut,
class TDerived>
1413 return book == bs->book();
1422 if (inXRP && outXRP)
1424 UNREACHABLE(
"ripple::test::bookStepEqual : no XRP to XRP book step");
1427 if (inXRP && !outXRP)
1432 if (!inXRP && outXRP)
1437 if (!inXRP && !outXRP)
1448template <
class TIn,
class TOut>
1456 auto offerCrossingStep =
1458 ter = offerCrossingStep->check(ctx);
1459 r = std::move(offerCrossingStep);
1465 ter = paymentStep->check(ctx);
1466 r = std::move(paymentStep);
1469 return {ter,
nullptr};
1477 return make_BookStepHelper<IOUAmount, IOUAmount>(ctx,
in,
out);
1483 return make_BookStepHelper<IOUAmount, XRPAmount>(ctx,
in,
xrpIssue());
1489 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
uint32_t const maxOffersToConsume_
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)
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
static uint32_t getMaxOffersToConsume(StrandContext const &ctx)
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.