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

Classes

struct  Cache

Public Member Functions

Book const & book () const
std::optional< EitherAmountcachedIn () const override
std::optional< EitherAmountcachedOut () const override
DebtDirection debtDirection (ReadView const &sb, StrandDirection dir) const override
std::optional< BookbookStepBook () const override
std::pair< std::optional< Quality >, DebtDirectionqualityUpperBound (ReadView const &v, DebtDirection prevStepDir) const override
std::pair< std::optional< QualityFunction >, DebtDirectiongetQualityFunc (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, EitherAmountvalidFwd (PaymentSandbox &sb, ApplyView &afView, EitherAmount const &in) override
TER check (StrandContext const &ctx) const
bool inactive () const override

Protected Types

enum class  OfferType { Amm , Clob }

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_ = nullptr
bool const ownerPaysTransferFee_
bool inactive_ = false
std::uint32_t offersUsed_ = 0
 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< Cachecache_

Static Protected Attributes

static constexpr uint32_t kMaxOffersToConsume {1000}

Private Member Functions

 BookStep (StrandContext const &ctx, Asset const &in, Asset const &out)
bool equal (Step const &rhs) const override
template<class Callback>
std::pair< boost::container::flat_set< uint256 >, std::uint32_tforEachOffer (PaymentSandbox &sb, ApplyView &afView, DebtDirection prevStepDebtDir, Callback &callback) const
template<template< typename, typename > typename Offer>
void consumeOffer (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< QualityFunctiontipOfferQualityF (ReadView const &view) const
bool checkMPTDEX (ReadView const &view, AccountID const &owner) const

Private Attributes

friend TDerived

Friends

bool operator== (BookStep const &lhs, BookStep const &rhs)
bool operator!= (BookStep const &lhs, BookStep const &rhs)

Detailed Description

template<class TIn, class TOut, class TDerived>
class xrpl::BookStep< TIn, TOut, TDerived >

Definition at line 55 of file BookStep.cpp.

Member Enumeration Documentation

◆ OfferType

template<class TIn, class TOut, class TDerived>
enum class xrpl::BookStep::OfferType
strongprotected
Enumerator
Amm 
Clob 

Definition at line 58 of file BookStep.cpp.

Constructor & Destructor Documentation

◆ BookStep()

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

Definition at line 97 of file BookStep.cpp.

Member Function Documentation

◆ book()

template<class TIn, class TOut, class TDerived>
Book const & xrpl::BookStep< TIn, TOut, TDerived >::book ( ) const
nodiscard

Definition at line 122 of file BookStep.cpp.

◆ cachedIn()

template<class TIn, class TOut, class TDerived>
std::optional< EitherAmount > xrpl::BookStep< TIn, TOut, TDerived >::cachedIn ( ) const
nodiscardoverride

Definition at line 128 of file BookStep.cpp.

◆ cachedOut()

template<class TIn, class TOut, class TDerived>
std::optional< EitherAmount > xrpl::BookStep< TIn, TOut, TDerived >::cachedOut ( ) const
nodiscardoverride

Definition at line 136 of file BookStep.cpp.

◆ debtDirection()

template<class TIn, class TOut, class TDerived>
DebtDirection xrpl::BookStep< TIn, TOut, TDerived >::debtDirection ( ReadView const & sb,
StrandDirection dir ) const
nodiscardoverride

Definition at line 144 of file BookStep.cpp.

◆ bookStepBook()

template<class TIn, class TOut, class TDerived>
std::optional< Book > xrpl::BookStep< TIn, TOut, TDerived >::bookStepBook ( ) const
nodiscardoverride

Definition at line 150 of file BookStep.cpp.

◆ qualityUpperBound()

template<class TIn, class TOut, class TDerived>
std::pair< std::optional< Quality >, DebtDirection > xrpl::BookStep< TIn, TOut, TDerived >::qualityUpperBound ( ReadView const & v,
DebtDirection prevStepDir ) const
nodiscardoverride

Definition at line 572 of file BookStep.cpp.

◆ getQualityFunc()

template<class TIn, class TOut, class TDerived>
std::pair< std::optional< QualityFunction >, DebtDirection > xrpl::BookStep< TIn, TOut, TDerived >::getQualityFunc ( ReadView const & v,
DebtDirection prevStepDir ) const
nodiscardoverride

Definition at line 590 of file BookStep.cpp.

◆ offersUsed()

template<class TIn, class TOut, class TDerived>
std::uint32_t xrpl::BookStep< TIn, TOut, TDerived >::offersUsed ( ) const
nodiscardoverride

Definition at line 625 of file BookStep.cpp.

◆ revImp()

template<class TIn, class TOut, class TDerived>
std::pair< TIn, TOut > xrpl::BookStep< TIn, TOut, TDerived >::revImp ( PaymentSandbox & sb,
ApplyView & afView,
boost::container::flat_set< uint256 > & ofrsToRm,
TOut const & out )

Definition at line 1003 of file BookStep.cpp.

◆ fwdImp()

template<class TIn, class TOut, class TDerived>
std::pair< TIn, TOut > xrpl::BookStep< TIn, TOut, TDerived >::fwdImp ( PaymentSandbox & sb,
ApplyView & afView,
boost::container::flat_set< uint256 > & ofrsToRm,
TIn const & in )

Definition at line 1114 of file BookStep.cpp.

◆ validFwd()

template<class TIn, class TOut, class TDerived>
std::pair< bool, EitherAmount > xrpl::BookStep< TIn, TOut, TDerived >::validFwd ( PaymentSandbox & sb,
ApplyView & afView,
EitherAmount const & in )
override

Definition at line 1276 of file BookStep.cpp.

◆ check()

template<class TIn, class TOut, class TDerived>
TER xrpl::BookStep< TIn, TOut, TDerived >::check ( StrandContext const & ctx) const
nodiscard

Definition at line 1315 of file BookStep.cpp.

◆ inactive()

template<class TIn, class TOut, class TDerived>
bool xrpl::BookStep< TIn, TOut, TDerived >::inactive ( ) const
nodiscardoverride

Definition at line 186 of file BookStep.cpp.

◆ logStringImpl()

template<class TIn, class TOut, class TDerived>
std::string xrpl::BookStep< TIn, TOut, TDerived >::logStringImpl ( char const * name) const
protected

Definition at line 193 of file BookStep.cpp.

◆ rate()

template<class TIn, class TOut, class TDerived>
Rate xrpl::BookStep< TIn, TOut, TDerived >::rate ( ReadView const & view,
Asset const & asset,
AccountID const & dstAccount ) const
nodiscardprotected

Definition at line 1386 of file BookStep.cpp.

◆ equal()

template<class TIn, class TOut, class TDerived>
bool xrpl::BookStep< TIn, TOut, TDerived >::equal ( Step const & rhs) const
nodiscardoverrideprivate

Definition at line 563 of file BookStep.cpp.

◆ forEachOffer()

template<class TIn, class TOut, class TDerived>
template<class Callback>
std::pair< boost::container::flat_set< uint256 >, std::uint32_t > xrpl::BookStep< TIn, TOut, TDerived >::forEachOffer ( PaymentSandbox & sb,
ApplyView & afView,
DebtDirection prevStepDebtDir,
Callback & callback ) const
private

Definition at line 686 of file BookStep.cpp.

◆ consumeOffer()

template<class TIn, class TOut, class TDerived>
template<template< typename, typename > typename Offer>
void xrpl::BookStep< TIn, TOut, TDerived >::consumeOffer ( PaymentSandbox & sb,
Offer< TIn, TOut > & offer,
TAmounts< TIn, TOut > const & ofrAmt,
TAmounts< TIn, TOut > const & stepAmt,
TOut const & ownerGives ) const
private

Definition at line 858 of file BookStep.cpp.

◆ getAMMOffer()

template<class TIn, class TOut, class TDerived>
std::optional< AMMOffer< TIn, TOut > > xrpl::BookStep< TIn, TOut, TDerived >::getAMMOffer ( ReadView const & view,
std::optional< Quality > const & clobQuality ) const
private

Definition at line 904 of file BookStep.cpp.

◆ tip()

template<class TIn, class TOut, class TDerived>
std::optional< std::variant< Quality, AMMOffer< TIn, TOut > > > xrpl::BookStep< TIn, TOut, TDerived >::tip ( ReadView const & view) const
private

Definition at line 920 of file BookStep.cpp.

◆ tipOfferQuality()

template<class TIn, class TOut, class TDerived>
auto xrpl::BookStep< TIn, TOut, TDerived >::tipOfferQuality ( ReadView const & view) const
private

Definition at line 958 of file BookStep.cpp.

◆ tipOfferQualityF()

template<class TIn, class TOut, class TDerived>
std::optional< QualityFunction > xrpl::BookStep< TIn, TOut, TDerived >::tipOfferQualityF ( ReadView const & view) const
nodiscardprivate

Definition at line 976 of file BookStep.cpp.

◆ checkMPTDEX()

template<class TIn, class TOut, class TDerived>
bool xrpl::BookStep< TIn, TOut, TDerived >::checkMPTDEX ( ReadView const & view,
AccountID const & owner ) const
nodiscardprivate

Definition at line 1411 of file BookStep.cpp.

◆ operator==

template<class TIn, class TOut, class TDerived>
bool operator== ( BookStep< TIn, TOut, TDerived > const & lhs,
BookStep< TIn, TOut, TDerived > const & rhs )
friend

Definition at line 207 of file BookStep.cpp.

◆ operator!=

template<class TIn, class TOut, class TDerived>
bool operator!= ( BookStep< TIn, TOut, TDerived > const & lhs,
BookStep< TIn, TOut, TDerived > const & rhs )
friend

Definition at line 213 of file BookStep.cpp.

Member Data Documentation

◆ kMaxOffersToConsume

template<class TIn, class TOut, class TDerived>
uint32_t xrpl::BookStep< TIn, TOut, TDerived >::kMaxOffersToConsume {1000}
staticconstexprprotected

Definition at line 60 of file BookStep.cpp.

◆ book_

template<class TIn, class TOut, class TDerived>
Book xrpl::BookStep< TIn, TOut, TDerived >::book_
protected

Definition at line 61 of file BookStep.cpp.

◆ strandSrc_

template<class TIn, class TOut, class TDerived>
AccountID xrpl::BookStep< TIn, TOut, TDerived >::strandSrc_
protected

Definition at line 62 of file BookStep.cpp.

◆ strandDst_

template<class TIn, class TOut, class TDerived>
AccountID xrpl::BookStep< TIn, TOut, TDerived >::strandDst_
protected

Definition at line 63 of file BookStep.cpp.

◆ prevStep_

template<class TIn, class TOut, class TDerived>
Step const* const xrpl::BookStep< TIn, TOut, TDerived >::prevStep_ = nullptr
protected

Definition at line 65 of file BookStep.cpp.

◆ ownerPaysTransferFee_

template<class TIn, class TOut, class TDerived>
bool const xrpl::BookStep< TIn, TOut, TDerived >::ownerPaysTransferFee_
protected

Definition at line 66 of file BookStep.cpp.

◆ inactive_

template<class TIn, class TOut, class TDerived>
bool xrpl::BookStep< TIn, TOut, TDerived >::inactive_ = false
protected

Definition at line 68 of file BookStep.cpp.

◆ offersUsed_

template<class TIn, class TOut, class TDerived>
std::uint32_t xrpl::BookStep< TIn, TOut, TDerived >::offersUsed_ = 0
protected

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 76 of file BookStep.cpp.

◆ ammLiquidity_

template<class TIn, class TOut, class TDerived>
std::optional<AMMLiquidity<TIn, TOut> > xrpl::BookStep< TIn, TOut, TDerived >::ammLiquidity_
protected

Definition at line 80 of file BookStep.cpp.

◆ j_

template<class TIn, class TOut, class TDerived>
beast::Journal const xrpl::BookStep< TIn, TOut, TDerived >::j_
protected

Definition at line 81 of file BookStep.cpp.

◆ strandDeliver_

template<class TIn, class TOut, class TDerived>
Asset const xrpl::BookStep< TIn, TOut, TDerived >::strandDeliver_
protected

Definition at line 82 of file BookStep.cpp.

◆ cache_

template<class TIn, class TOut, class TDerived>
std::optional<Cache> xrpl::BookStep< TIn, TOut, TDerived >::cache_
protected

Definition at line 94 of file BookStep.cpp.

◆ TDerived

template<class TIn, class TOut, class TDerived>
friend xrpl::BookStep< TIn, TOut, TDerived >::TDerived
private

Definition at line 269 of file BookStep.cpp.