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

#include <Offer.h>

Inheritance diagram for xrpl::TOffer< TIn, TOut >:
Inheritance graph
[legend]
Collaboration diagram for xrpl::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 &offerAmount, TOut const &limit, bool roundUp) const
 
TAmounts< TIn, TOut > limitIn (TAmounts< TIn, TOut > const &offerAmount, 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 xrpl::TOffer< TIn, TOut >

Definition at line 32 of file Offer.h.

Constructor & Destructor Documentation

◆ TOffer() [1/3]

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

◆ TOffer() [2/3]

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

Definition at line 181 of file Offer.h.

◆ TOffer() [3/3]

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

Definition at line 195 of file Offer.h.

Member Function Documentation

◆ setFieldAmounts() [1/5]

template<class TIn , class TOut >
void xrpl::TOffer< TIn, TOut >::setFieldAmounts ( )
private

Definition at line 209 of file Offer.h.

◆ quality()

template<class TIn = STAmount, class TOut = STAmount>
Quality xrpl::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 58 of file Offer.h.

◆ owner()

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

Returns the account id of the offer's owner.

Definition at line 65 of file Offer.h.

◆ amount()

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

Returns the in and out amounts.

Some or all of the out amount may be unfunded.

Definition at line 74 of file Offer.h.

◆ fully_consumed()

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

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

Definition at line 81 of file Offer.h.

◆ consume()

template<class TIn = STAmount, class TOut = STAmount>
void xrpl::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 92 of file Offer.h.

◆ id()

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

Definition at line 106 of file Offer.h.

◆ key()

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

Definition at line 112 of file Offer.h.

◆ issueIn() [1/2]

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

Definition at line 291 of file Offer.h.

◆ issueOut() [1/2]

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

Definition at line 305 of file Offer.h.

◆ limitOut()

template<class TIn , class TOut >
TAmounts< TIn, TOut > xrpl::TOffer< TIn, TOut >::limitOut ( TAmounts< TIn, TOut > const &  offerAmount,
TOut const &  limit,
bool  roundUp 
) const

Definition at line 222 of file Offer.h.

◆ limitIn()

template<class TIn , class TOut >
TAmounts< TIn, TOut > xrpl::TOffer< TIn, TOut >::limitIn ( TAmounts< TIn, TOut > const &  offerAmount,
TIn const &  limit,
bool  roundUp 
) const

Definition at line 234 of file Offer.h.

◆ send()

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

Definition at line 252 of file Offer.h.

◆ isFunded()

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

Definition at line 139 of file Offer.h.

◆ adjustRates()

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

Definition at line 146 of file Offer.h.

◆ checkInvariant()

template<class TIn = STAmount, class TOut = STAmount>
bool xrpl::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 156 of file Offer.h.

◆ setFieldAmounts() [2/5]

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

Definition at line 259 of file Offer.h.

◆ setFieldAmounts() [3/5]

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

Definition at line 267 of file Offer.h.

◆ setFieldAmounts() [4/5]

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

Definition at line 275 of file Offer.h.

◆ setFieldAmounts() [5/5]

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

Definition at line 283 of file Offer.h.

◆ issueIn() [2/2]

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

Definition at line 298 of file Offer.h.

◆ issueOut() [2/2]

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

Definition at line 312 of file Offer.h.

Member Data Documentation

◆ m_entry

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

Definition at line 35 of file Offer.h.

◆ m_quality

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

Definition at line 36 of file Offer.h.

◆ m_account

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

Definition at line 37 of file Offer.h.

◆ m_amounts

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

Definition at line 39 of file Offer.h.

◆ issIn_

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

Definition at line 20 of file Offer.h.

◆ issOut_

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

Definition at line 21 of file Offer.h.