rippled
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ripple::TOffer< TIn, TOut > Class Template Reference

#include <Offer.h>

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.
 
AccountID const & owner () const
 Returns the account id of the offer's owner.
 
TAmounts< TIn, TOut > const & amount () const
 Returns the in and out amounts.
 
bool fully_consumed () const
 Returns true if no more funds can flow through this offer.
 
void consume (ApplyView &view, TAmounts< TIn, TOut > const &consumed)
 Adjusts the offer to indicate that we consumed some (or all) of it.
 
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 roundUp) const
 
TAmounts< TIn, TOut > limitIn (TAmounts< TIn, TOut > const &offrAmt, TIn const &limit, bool roundUp) const
 
bool isFunded () const
 
bool checkInvariant (TAmounts< TIn, TOut > const &consumed, beast::Journal j) const
 Check any required invariant.
 
 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
 
Issue issIn_
 
Issue issOut_
 

Detailed Description

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

Definition at line 51 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 198 of file Offer.h.

◆ TOffer() [3/3]

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

Definition at line 212 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 226 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 77 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 84 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 93 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 100 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 111 of file Offer.h.

◆ id()

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

Definition at line 125 of file Offer.h.

◆ key()

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

Definition at line 131 of file Offer.h.

◆ issueIn() [1/2]

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

Definition at line 308 of file Offer.h.

◆ issueOut() [1/2]

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

Definition at line 322 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  roundUp 
) const

Definition at line 239 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,
bool  roundUp 
) const

Definition at line 251 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 269 of file Offer.h.

◆ isFunded()

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

Definition at line 156 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 163 of file Offer.h.

◆ checkInvariant()

template<class TIn = STAmount, class TOut = STAmount>
bool ripple::TOffer< TIn, TOut >::checkInvariant ( TAmounts< TIn, TOut > const &  consumed,
beast::Journal  j 
) const

Check any required invariant.

Limit order book offer always returns true.

Definition at line 173 of file Offer.h.

◆ setFieldAmounts() [2/5]

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

Definition at line 276 of file Offer.h.

◆ setFieldAmounts() [3/5]

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

Definition at line 284 of file Offer.h.

◆ setFieldAmounts() [4/5]

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

Definition at line 292 of file Offer.h.

◆ setFieldAmounts() [5/5]

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

Definition at line 300 of file Offer.h.

◆ issueIn() [2/2]

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

Definition at line 315 of file Offer.h.

◆ issueOut() [2/2]

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

Definition at line 329 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 54 of file Offer.h.

◆ m_quality

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

Definition at line 55 of file Offer.h.

◆ m_account

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

Definition at line 56 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 58 of file Offer.h.

◆ issIn_

template<class TIn , class TOut >
Issue ripple::TOfferBase< TIn, TOut >::issIn_
protectedinherited

Definition at line 39 of file Offer.h.

◆ issOut_

template<class TIn , class TOut >
Issue ripple::TOfferBase< TIn, TOut >::issOut_
protectedinherited

Definition at line 40 of file Offer.h.