rippled
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ripple::TOffer< TIn, TOut > Class Template Reference
Inheritance diagram for ripple::TOffer< TIn, TOut >:
Inheritance graph
[legend]
Collaboration diagram for ripple::TOffer< TIn, TOut >:
Collaboration graph
[legend]

Public Member Functions

 TOffer ()=default
 
 TOffer (SLE::pointer const &entry, Quality quality)
 
Quality quality () const noexcept
 Returns the quality of the offer. More...
 
AccountID const & owner () const
 Returns the account id of the offer's owner. More...
 
TAmounts< TIn, TOut > const & amount () const
 Returns the in and out amounts. More...
 
bool fully_consumed () const
 Returns true if no more funds can flow through this offer. More...
 
void consume (ApplyView &view, TAmounts< TIn, TOut > const &consumed)
 Adjusts the offer to indicate that we consumed some (or all) of it. More...
 
std::string id () const
 
std::optional< uint256key () const
 
Issue const & issueIn () const
 
Issue const & issueOut () const
 
TAmounts< TIn, TOut > limitOut (TAmounts< TIn, TOut > const &offrAmt, TOut const &limit, bool fixReducedOffers, bool roundUp) const
 
TAmounts< TIn, TOut > limitIn (TAmounts< TIn, TOut > const &offrAmt, TIn const &limit) const
 
bool isFunded () const
 
 TOffer (SLE::pointer const &entry, Quality quality)
 
Issue const & issueIn () const
 
Issue const & issueOut () const
 

Static Public Member Functions

template<typename... Args>
static TER send (Args &&... args)
 
static std::pair< std::uint32_t, std::uint32_tadjustRates (std::uint32_t ofrInRate, std::uint32_t ofrOutRate)
 

Private Member Functions

void setFieldAmounts ()
 
void setFieldAmounts ()
 
void setFieldAmounts ()
 
void setFieldAmounts ()
 
void setFieldAmounts ()
 

Private Attributes

SLE::pointer m_entry
 
Quality m_quality
 
AccountID m_account
 
TAmounts< TIn, TOut > m_amounts
 

Detailed Description

template<class TIn = STAmount, class TOut = STAmount>
class ripple::TOffer< TIn, TOut >

Definition at line 49 of file Offer.h.

Constructor & Destructor Documentation

◆ TOffer() [1/3]

template<class TIn = STAmount, class TOut = STAmount>
ripple::TOffer< TIn, TOut >::TOffer ( )
default

◆ TOffer() [2/3]

template<class TIn , class TOut >
ripple::TOffer< TIn, TOut >::TOffer ( SLE::pointer const &  entry,
Quality  quality 
)

Definition at line 171 of file Offer.h.

◆ TOffer() [3/3]

ripple::TOffer< STAmount, STAmount >::TOffer ( SLE::pointer const &  entry,
Quality  quality 
)

Definition at line 185 of file Offer.h.

Member Function Documentation

◆ setFieldAmounts() [1/5]

template<class TIn , class TOut >
void ripple::TOffer< TIn, TOut >::setFieldAmounts
private

Definition at line 199 of file Offer.h.

◆ quality()

template<class TIn = STAmount, class TOut = STAmount>
Quality ripple::TOffer< TIn, TOut >::quality ( ) const
noexcept

Returns the quality of the offer.

Conceptually, the quality is the ratio of output to input currency. The implementation calculates it as the ratio of input to output currency (so it sorts ascending). The quality is computed at the time the offer is placed, and never changes for the lifetime of the offer. This is an important business rule that maintains accuracy when an offer is partially filled; Subsequent partial fills will use the original quality.

Definition at line 75 of file Offer.h.

◆ owner()

template<class TIn = STAmount, class TOut = STAmount>
AccountID const& ripple::TOffer< TIn, TOut >::owner ( ) const

Returns the account id of the offer's owner.

Definition at line 82 of file Offer.h.

◆ amount()

template<class TIn = STAmount, class TOut = STAmount>
TAmounts<TIn, TOut> const& ripple::TOffer< TIn, TOut >::amount ( ) const

Returns the in and out amounts.

Some or all of the out amount may be unfunded.

Definition at line 91 of file Offer.h.

◆ fully_consumed()

template<class TIn = STAmount, class TOut = STAmount>
bool ripple::TOffer< TIn, TOut >::fully_consumed ( ) const

Returns true if no more funds can flow through this offer.

Definition at line 98 of file Offer.h.

◆ consume()

template<class TIn = STAmount, class TOut = STAmount>
void ripple::TOffer< TIn, TOut >::consume ( ApplyView view,
TAmounts< TIn, TOut > const &  consumed 
)

Adjusts the offer to indicate that we consumed some (or all) of it.

Definition at line 109 of file Offer.h.

◆ id()

template<class TIn = STAmount, class TOut = STAmount>
std::string ripple::TOffer< TIn, TOut >::id ( ) const

Definition at line 123 of file Offer.h.

◆ key()

template<class TIn = STAmount, class TOut = STAmount>
std::optional<uint256> ripple::TOffer< TIn, TOut >::key ( ) const

Definition at line 129 of file Offer.h.

◆ issueIn() [1/2]

template<class TIn , class TOut >
Issue const & ripple::TOffer< TIn, TOut >::issueIn

Definition at line 275 of file Offer.h.

◆ issueOut() [1/2]

template<class TIn , class TOut >
Issue const & ripple::TOffer< TIn, TOut >::issueOut

Definition at line 289 of file Offer.h.

◆ limitOut()

template<class TIn , class TOut >
TAmounts< TIn, TOut > ripple::TOffer< TIn, TOut >::limitOut ( TAmounts< TIn, TOut > const &  offrAmt,
TOut const &  limit,
bool  fixReducedOffers,
bool  roundUp 
) const

Definition at line 210 of file Offer.h.

◆ limitIn()

template<class TIn , class TOut >
TAmounts< TIn, TOut > ripple::TOffer< TIn, TOut >::limitIn ( TAmounts< TIn, TOut > const &  offrAmt,
TIn const &  limit 
) const

Definition at line 227 of file Offer.h.

◆ send()

template<class TIn , class TOut >
template<typename... Args>
TER ripple::TOffer< TIn, TOut >::send ( Args &&...  args)
static

Definition at line 236 of file Offer.h.

◆ isFunded()

template<class TIn = STAmount, class TOut = STAmount>
bool ripple::TOffer< TIn, TOut >::isFunded ( ) const

Definition at line 154 of file Offer.h.

◆ adjustRates()

template<class TIn = STAmount, class TOut = STAmount>
static std::pair<std::uint32_t, std::uint32_t> ripple::TOffer< TIn, TOut >::adjustRates ( std::uint32_t  ofrInRate,
std::uint32_t  ofrOutRate 
)
static

Definition at line 161 of file Offer.h.

◆ setFieldAmounts() [2/5]

void ripple::TOffer< STAmount, STAmount >::setFieldAmounts ( )
private

Definition at line 243 of file Offer.h.

◆ setFieldAmounts() [3/5]

void ripple::TOffer< IOUAmount, IOUAmount >::setFieldAmounts ( )
private

Definition at line 251 of file Offer.h.

◆ setFieldAmounts() [4/5]

void ripple::TOffer< IOUAmount, XRPAmount >::setFieldAmounts ( )
private

Definition at line 259 of file Offer.h.

◆ setFieldAmounts() [5/5]

void ripple::TOffer< XRPAmount, IOUAmount >::setFieldAmounts ( )
private

Definition at line 267 of file Offer.h.

◆ issueIn() [2/2]

Issue const & ripple::TOffer< STAmount, STAmount >::issueIn ( ) const

Definition at line 282 of file Offer.h.

◆ issueOut() [2/2]

Issue const & ripple::TOffer< STAmount, STAmount >::issueOut ( ) const

Definition at line 296 of file Offer.h.

Member Data Documentation

◆ m_entry

template<class TIn = STAmount, class TOut = STAmount>
SLE::pointer ripple::TOffer< TIn, TOut >::m_entry
private

Definition at line 52 of file Offer.h.

◆ m_quality

template<class TIn = STAmount, class TOut = STAmount>
Quality ripple::TOffer< TIn, TOut >::m_quality
private

Definition at line 53 of file Offer.h.

◆ m_account

template<class TIn = STAmount, class TOut = STAmount>
AccountID ripple::TOffer< TIn, TOut >::m_account
private

Definition at line 54 of file Offer.h.

◆ m_amounts

template<class TIn = STAmount, class TOut = STAmount>
TAmounts<TIn, TOut> ripple::TOffer< TIn, TOut >::m_amounts
private

Definition at line 56 of file Offer.h.