rippled
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ripple::OfferStream Class Reference

Presents and consumes the offers in an order book. More...

Inheritance diagram for ripple::OfferStream:
Inheritance graph
[legend]
Collaboration diagram for ripple::OfferStream:
Collaboration graph
[legend]

Public Member Functions

TOffer< STAmount, STAmount > & tip () const
 Returns the offer at the tip of the order book. More...
 
bool step ()
 Advance to the next valid offer. More...
 
STAmount ownerFunds () const
 

Protected Member Functions

void permRmOffer (uint256 const &offerIndex) override
 
void erase (ApplyView &view)
 
bool shouldRmSmallIncreasedQOffer () const
 

Protected Attributes

const beast::Journal j_
 
ApplyViewview_
 
ApplyViewcancelView_
 
Book book_
 
bool validBook_
 
const NetClock::time_point expire_
 
BookTip tip_
 
TOffer< STAmount, STAmountoffer_
 
std::optional< STAmountownerFunds_
 
StepCounter & counter_
 

Detailed Description

Presents and consumes the offers in an order book.

Two ApplyView objects accumulate changes to the ledger. view is applied when the calling transaction succeeds. If the calling transaction fails, then view_cancel is applied.

Certain invalid offers are automatically removed:

When an offer is removed, it is removed from both views. This grooms the order book regardless of whether or not the transaction is successful.

Definition at line 147 of file OfferStream.h.

Member Function Documentation

◆ permRmOffer()

void ripple::OfferStream::permRmOffer ( uint256 const &  offerIndex)
overrideprotectedvirtual

Implements ripple::TOfferStreamBase< STAmount, STAmount >.

Definition at line 365 of file OfferStream.cpp.

◆ erase()

void ripple::TOfferStreamBase< STAmount , STAmount >::erase ( ApplyView view)
protectedinherited

Definition at line 61 of file OfferStream.cpp.

◆ shouldRmSmallIncreasedQOffer()

bool ripple::TOfferStreamBase< STAmount , STAmount >::shouldRmSmallIncreasedQOffer
protectedinherited

Definition at line 139 of file OfferStream.cpp.

◆ tip()

Returns the offer at the tip of the order book.

Offers are always presented in decreasing quality. Only valid if step() returned true.

Definition at line 108 of file OfferStream.h.

◆ step()

bool ripple::TOfferStreamBase< STAmount , STAmount >::step
inherited

Advance to the next valid offer.

This automatically removes:

  • Offers with missing ledger entries
  • Offers found unfunded
  • expired offers
    Returns
    true if there is a valid offer.

Definition at line 205 of file OfferStream.cpp.

◆ ownerFunds()

STAmount ripple::TOfferStreamBase< STAmount , STAmount >::ownerFunds
inherited

Definition at line 124 of file OfferStream.h.

Member Data Documentation

◆ j_

const beast::Journal ripple::TOfferStreamBase< STAmount , STAmount >::j_
protectedinherited

Definition at line 71 of file OfferStream.h.

◆ view_

ApplyView& ripple::TOfferStreamBase< STAmount , STAmount >::view_
protectedinherited

Definition at line 72 of file OfferStream.h.

◆ cancelView_

ApplyView& ripple::TOfferStreamBase< STAmount , STAmount >::cancelView_
protectedinherited

Definition at line 73 of file OfferStream.h.

◆ book_

Book ripple::TOfferStreamBase< STAmount , STAmount >::book_
protectedinherited

Definition at line 74 of file OfferStream.h.

◆ validBook_

bool ripple::TOfferStreamBase< STAmount , STAmount >::validBook_
protectedinherited

Definition at line 75 of file OfferStream.h.

◆ expire_

const NetClock::time_point ripple::TOfferStreamBase< STAmount , STAmount >::expire_
protectedinherited

Definition at line 76 of file OfferStream.h.

◆ tip_

BookTip ripple::TOfferStreamBase< STAmount , STAmount >::tip_
protectedinherited

Definition at line 77 of file OfferStream.h.

◆ offer_

TOffer<STAmount , STAmount > ripple::TOfferStreamBase< STAmount , STAmount >::offer_
protectedinherited

Definition at line 78 of file OfferStream.h.

◆ ownerFunds_

std::optional<STAmount > ripple::TOfferStreamBase< STAmount , STAmount >::ownerFunds_
protectedinherited

Definition at line 79 of file OfferStream.h.

◆ counter_

StepCounter& ripple::TOfferStreamBase< STAmount , STAmount >::counter_
protectedinherited

Definition at line 80 of file OfferStream.h.