xrpld
Loading...
Searching...
No Matches
xrpl::BookPaymentStep< TIn, TOut > Class Template Reference
Inheritance diagram for xrpl::BookPaymentStep< TIn, TOut >:
Collaboration diagram for xrpl::BookPaymentStep< TIn, TOut >:

Public Member Functions

 BookPaymentStep ()=default
 BookPaymentStep (StrandContext const &ctx, Asset const &in, Asset const &out)
template<template< typename, typename > typename Offer>
bool limitSelfCrossQuality (AccountID const &, AccountID const &, Offer< TIn, TOut > const &offer, std::optional< Quality > &, FlowOfferStream< TIn, TOut > &, bool) const
bool checkQualityThreshold (Quality const &quality) const
std::optional< Quality > qualityThreshold (Quality const &lobQuality) const
std::uint32_t getOfrInRate (Step const *, AccountID const &, std::uint32_t trIn) const
std::uint32_t getOfrOutRate (Step const *, AccountID const &, AccountID const &, std::uint32_t trOut) const
Quality adjustQualityWithFees (ReadView const &v, Quality const &ofrQ, DebtDirection prevStepDir, WaiveTransferFee waiveFee, OfferType) const
std::string logString () const override
Book const & book () const
std::optional< EitherAmount > cachedIn () const override
std::optional< EitherAmount > cachedOut () const override
DebtDirection debtDirection (ReadView const &sb, StrandDirection dir) const override
std::optional< Book > bookStepBook () const override
std::pair< std::optional< Quality >, DebtDirection > qualityUpperBound (ReadView const &v, DebtDirection prevStepDir) const override
std::pair< std::optional< QualityFunction >, DebtDirection > getQualityFunc (ReadView const &v, DebtDirection prevStepDir) const override
std::uint32_t offersUsed () const override
std::pair< TIn, TOut > revImp (PaymentSandbox &sb, ApplyView &afView, boost::container::flat_set< UInt256 > &ofrsToRm, TOut const &out)
std::pair< TIn, TOut > fwdImp (PaymentSandbox &sb, ApplyView &afView, boost::container::flat_set< UInt256 > &ofrsToRm, TIn const &in)
std::pair< bool, EitherAmount > validFwd (PaymentSandbox &sb, ApplyView &afView, EitherAmount const &in) override
TER check (StrandContext const &ctx) const
bool inactive () const override

Protected Types

enum  OfferType

Protected Member Functions

std::string logStringImpl (char const *name) const
Rate rate (ReadView const &view, Asset const &asset, AccountID const &dstAccount) const

Protected Attributes

Book book_
AccountID strandSrc_
AccountID strandDst_
Step const *const prevStep_
bool const ownerPaysTransferFee_
bool inactive_
std::uint32_t offersUsed_
 Number of offers consumed or partially consumed the last time the step ran, including expired and unfunded offers.
std::optional< AMMLiquidity< TIn, TOut > > ammLiquidity_
beast::Journal const j_
Asset const strandDeliver_
std::optional< TIn > maxIn_
std::optional< Cache > cache_

Static Protected Attributes

static constexpr uint32_t kMaxOffersToConsume

Private Member Functions

bool equal (Step const &rhs) const override
std::pair< boost::container::flat_set< UInt256 >, std::uint32_t > forEachOffer (PaymentSandbox &sb, ApplyView &afView, DebtDirection prevStepDebtDir, Callback &callback) const
void consumeOffer (PaymentSandbox &sb, Offer< TIn, TOut > &offer, TAmounts< TIn, TOut > const &ofrAmt, TAmounts< TIn, TOut > const &stepAmt, TOut const &ownerGives) const
void tryConsumeOffer (PaymentSandbox &sb, Offer< TIn, TOut > &offer, TAmounts< TIn, TOut > const &ofrAmt, TAmounts< TIn, TOut > const &stepAmt, TOut const &ownerGives) const
std::optional< AMMOffer< TIn, TOut > > getAMMOffer (ReadView const &view, std::optional< Quality > const &clobQuality) const
std::optional< std::variant< Quality, AMMOffer< TIn, TOut > > > tip (ReadView const &view) const
std::optional< std::pair< Quality, OfferType > > tipOfferQuality (ReadView const &view) const
std::optional< QualityFunction > tipOfferQualityF (ReadView const &view) const
bool checkMPTDEX (ReadView const &view, AccountID const &owner) const

Private Attributes

friend TDerived

Detailed Description

template<class TIn, class TOut>
class xrpl::BookPaymentStep< TIn, TOut >

Definition at line 304 of file BookStep.cpp.

Member Enumeration Documentation

◆ OfferType

enum xrpl::BookStep::OfferType
strongprotectedinherited

Definition at line 59 of file BookStep.cpp.

Constructor & Destructor Documentation

◆ BookPaymentStep() [1/2]

template<class TIn, class TOut>
xrpl::BookPaymentStep< TIn, TOut >::BookPaymentStep ( )
explicitdefault

◆ BookPaymentStep() [2/2]

template<class TIn, class TOut>
xrpl::BookPaymentStep< TIn, TOut >::BookPaymentStep ( StrandContext const & ctx,
Asset const & in,
Asset const & out )

Definition at line 309 of file BookStep.cpp.

Member Function Documentation

◆ limitSelfCrossQuality()

template<class TIn, class TOut>
template<template< typename, typename > typename Offer>
bool xrpl::BookPaymentStep< TIn, TOut >::limitSelfCrossQuality ( AccountID const & ,
AccountID const & ,
Offer< TIn, TOut > const & offer,
std::optional< Quality > & ,
FlowOfferStream< TIn, TOut > & ,
bool  ) const

Definition at line 320 of file BookStep.cpp.

◆ checkQualityThreshold()

template<class TIn, class TOut>
bool xrpl::BookPaymentStep< TIn, TOut >::checkQualityThreshold ( Quality const & quality) const
nodiscard

Definition at line 333 of file BookStep.cpp.

◆ qualityThreshold()

template<class TIn, class TOut>
std::optional< Quality > xrpl::BookPaymentStep< TIn, TOut >::qualityThreshold ( Quality const & lobQuality) const
nodiscard

Definition at line 341 of file BookStep.cpp.

◆ getOfrInRate()

template<class TIn, class TOut>
std::uint32_t xrpl::BookPaymentStep< TIn, TOut >::getOfrInRate ( Step const * ,
AccountID const & ,
std::uint32_t trIn ) const

Definition at line 348 of file BookStep.cpp.

◆ getOfrOutRate()

template<class TIn, class TOut>
std::uint32_t xrpl::BookPaymentStep< TIn, TOut >::getOfrOutRate ( Step const * ,
AccountID const & ,
AccountID const & ,
std::uint32_t trOut ) const

Definition at line 355 of file BookStep.cpp.

◆ adjustQualityWithFees()

template<class TIn, class TOut>
Quality xrpl::BookPaymentStep< TIn, TOut >::adjustQualityWithFees ( ReadView const & v,
Quality const & ofrQ,
DebtDirection prevStepDir,
WaiveTransferFee waiveFee,
OfferType  ) const
nodiscard

Definition at line 361 of file BookStep.cpp.

◆ logString()

template<class TIn, class TOut>
std::string xrpl::BookPaymentStep< TIn, TOut >::logString ( ) const
nodiscardoverride

Definition at line 386 of file BookStep.cpp.

◆ book()

Book const & xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::book ( ) const
nodiscardinherited

Definition at line 135 of file BookStep.cpp.

◆ cachedIn()

std::optional< EitherAmount > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::cachedIn ( ) const
nodiscardoverrideinherited

Definition at line 141 of file BookStep.cpp.

◆ cachedOut()

std::optional< EitherAmount > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::cachedOut ( ) const
nodiscardoverrideinherited

Definition at line 149 of file BookStep.cpp.

◆ debtDirection()

DebtDirection xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::debtDirection ( ReadView const & sb,
StrandDirection dir ) const
nodiscardoverrideinherited

Definition at line 157 of file BookStep.cpp.

◆ bookStepBook()

std::optional< Book > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::bookStepBook ( ) const
nodiscardoverrideinherited

Definition at line 163 of file BookStep.cpp.

◆ qualityUpperBound()

std::pair< std::optional< Quality >, DebtDirection > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::qualityUpperBound ( ReadView const & v,
DebtDirection prevStepDir ) const
nodiscardoverrideinherited

Definition at line 169 of file BookStep.cpp.

◆ getQualityFunc()

std::pair< std::optional< QualityFunction >, DebtDirection > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::getQualityFunc ( ReadView const & v,
DebtDirection prevStepDir ) const
nodiscardoverrideinherited

Definition at line 172 of file BookStep.cpp.

◆ offersUsed()

std::uint32_t xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::offersUsed ( ) const
nodiscardoverrideinherited

Definition at line 175 of file BookStep.cpp.

◆ revImp()

std::pair< TIn, TOut > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::revImp ( PaymentSandbox & sb,
ApplyView & afView,
boost::container::flat_set< UInt256 > & ofrsToRm,
TOut const & out )
inherited

Definition at line 178 of file BookStep.cpp.

◆ fwdImp()

std::pair< TIn, TOut > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::fwdImp ( PaymentSandbox & sb,
ApplyView & afView,
boost::container::flat_set< UInt256 > & ofrsToRm,
TIn const & in )
inherited

Definition at line 185 of file BookStep.cpp.

◆ validFwd()

std::pair< bool, EitherAmount > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::validFwd ( PaymentSandbox & sb,
ApplyView & afView,
EitherAmount const & in )
overrideinherited

Definition at line 192 of file BookStep.cpp.

◆ check()

TER xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::check ( StrandContext const & ctx) const
nodiscardinherited

Definition at line 196 of file BookStep.cpp.

◆ inactive()

bool xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::inactive ( ) const
nodiscardoverrideinherited

Definition at line 199 of file BookStep.cpp.

◆ logStringImpl()

std::string xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::logStringImpl ( char const * name) const
protectedinherited

Definition at line 206 of file BookStep.cpp.

◆ rate()

Rate xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::rate ( ReadView const & view,
Asset const & asset,
AccountID const & dstAccount ) const
nodiscardprotectedinherited

Definition at line 216 of file BookStep.cpp.

◆ equal()

bool xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::equal ( Step const & rhs) const
nodiscardoverrideprivateinherited

Definition at line 232 of file BookStep.cpp.

◆ forEachOffer()

std::pair< boost::container::flat_set< UInt256 >, std::uint32_t > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::forEachOffer ( PaymentSandbox & sb,
ApplyView & afView,
DebtDirection prevStepDebtDir,
Callback & callback ) const
privateinherited

Definition at line 241 of file BookStep.cpp.

◆ consumeOffer()

void xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::consumeOffer ( PaymentSandbox & sb,
Offer< TIn, TOut > & offer,
TAmounts< TIn, TOut > const & ofrAmt,
TAmounts< TIn, TOut > const & stepAmt,
TOut const & ownerGives ) const
privateinherited

Definition at line 250 of file BookStep.cpp.

◆ tryConsumeOffer()

void xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::tryConsumeOffer ( PaymentSandbox & sb,
Offer< TIn, TOut > & offer,
TAmounts< TIn, TOut > const & ofrAmt,
TAmounts< TIn, TOut > const & stepAmt,
TOut const & ownerGives ) const
privateinherited

Definition at line 259 of file BookStep.cpp.

◆ getAMMOffer()

std::optional< AMMOffer< TIn, TOut > > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::getAMMOffer ( ReadView const & view,
std::optional< Quality > const & clobQuality ) const
privateinherited

Definition at line 270 of file BookStep.cpp.

◆ tip()

std::optional< std::variant< Quality, AMMOffer< TIn, TOut > > > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::tip ( ReadView const & view) const
privateinherited

Definition at line 275 of file BookStep.cpp.

◆ tipOfferQuality()

auto xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::tipOfferQuality ( ReadView const & view) const
privateinherited

Definition at line 280 of file BookStep.cpp.

◆ tipOfferQualityF()

std::optional< QualityFunction > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::tipOfferQualityF ( ReadView const & view) const
nodiscardprivateinherited

Definition at line 284 of file BookStep.cpp.

◆ checkMPTDEX()

bool xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::checkMPTDEX ( ReadView const & view,
AccountID const & owner ) const
nodiscardprivateinherited

Definition at line 289 of file BookStep.cpp.

Member Data Documentation

◆ kMaxOffersToConsume

uint32_t xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::kMaxOffersToConsume
staticconstexprprotectedinherited

Definition at line 61 of file BookStep.cpp.

◆ book_

Book xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::book_
protectedinherited

Definition at line 62 of file BookStep.cpp.

◆ strandSrc_

AccountID xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::strandSrc_
protectedinherited

Definition at line 63 of file BookStep.cpp.

◆ strandDst_

AccountID xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::strandDst_
protectedinherited

Definition at line 64 of file BookStep.cpp.

◆ prevStep_

Step const* const xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::prevStep_
protectedinherited

Definition at line 66 of file BookStep.cpp.

◆ ownerPaysTransferFee_

bool const xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::ownerPaysTransferFee_
protectedinherited

Definition at line 67 of file BookStep.cpp.

◆ inactive_

bool xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::inactive_
protectedinherited

Definition at line 69 of file BookStep.cpp.

◆ offersUsed_

std::uint32_t xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::offersUsed_
protectedinherited

Number of offers consumed or partially consumed the last time the step ran, including expired and unfunded offers.

N.B. This is not the total number offers consumed by this step for the entire payment, it is only the number the last time it ran. Offers may be partially consumed multiple times during a payment.

Definition at line 78 of file BookStep.cpp.

◆ ammLiquidity_

std::optional<AMMLiquidity<TIn, TOut> > xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::ammLiquidity_
protectedinherited

Definition at line 82 of file BookStep.cpp.

◆ j_

beast::Journal const xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::j_
protectedinherited

Definition at line 83 of file BookStep.cpp.

◆ strandDeliver_

Asset const xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::strandDeliver_
protectedinherited

Definition at line 84 of file BookStep.cpp.

◆ maxIn_

std::optional<TIn> xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::maxIn_
protectedinherited

Definition at line 89 of file BookStep.cpp.

◆ cache_

std::optional<Cache> xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::cache_
protectedinherited

Definition at line 101 of file BookStep.cpp.

◆ TDerived

friend xrpl::BookStep< TIn, TOut, BookPaymentStep< TIn, TOut > >::BookPaymentStep< TIn, TOut >
privateinherited

Definition at line 291 of file BookStep.cpp.