rippled
Classes | Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ripple::BasicTaker Class Referenceabstract

State for the active party during order book or payment operations. More...

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

Classes

struct  Flow
 

Public Member Functions

 BasicTaker ()=delete
 
 BasicTaker (BasicTaker const &)=delete
 
 BasicTaker (CrossType cross_type, AccountID const &account, Amounts const &amount, Quality const &quality, std::uint32_t flags, Rate const &rate_in, Rate const &rate_out, beast::Journal journal=beast::Journal{beast::Journal::getNullSink()})
 
virtual ~BasicTaker ()=default
 
Amounts remaining_offer () const
 Returns the amount remaining on the offer. More...
 
Amounts const & original_offer () const
 Returns the amount that the offer was originally placed at. More...
 
AccountID const & account () const noexcept
 Returns the account identifier of the taker. More...
 
bool reject (Quality const &quality) const noexcept
 Returns true if the quality does not meet the taker's requirements. More...
 
CrossType cross_type () const
 Returns the type of crossing that is being performed. More...
 
Issue const & issue_in () const
 Returns the Issue associated with the input of the offer. More...
 
Issue const & issue_out () const
 Returns the Issue associated with the output of the offer. More...
 
bool unfunded () const
 Returns true if the taker has run out of funds. More...
 
bool done () const
 Returns true if order crossing should not continue. More...
 
BasicTaker::Flow do_cross (Amounts offer, Quality quality, AccountID const &owner)
 Perform direct crossing through given offer. More...
 
std::pair< BasicTaker::Flow, BasicTaker::Flowdo_cross (Amounts offer1, Quality quality1, AccountID const &owner1, Amounts offer2, Quality quality2, AccountID const &owner2)
 Perform bridged crossing through given offers. More...
 
virtual STAmount get_funds (AccountID const &account, STAmount const &funds) const =0
 

Protected Attributes

const beast::Journal journal_
 

Private Member Functions

void log_flow (char const *description, Flow const &flow)
 
Flow flow_xrp_to_iou (Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_out)
 
Flow flow_iou_to_xrp (Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_in)
 
Flow flow_iou_to_iou (Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_in, Rate const &rate_out)
 
Rate in_rate (AccountID const &from, AccountID const &to) const
 
Rate out_rate (AccountID const &from, AccountID const &to) const
 

Static Private Member Functions

static Rate effective_rate (Rate const &rate, Issue const &issue, AccountID const &from, AccountID const &to)
 

Private Attributes

AccountID account_
 
Quality quality_
 
Quality threshold_
 
bool sell_
 
const Amounts original_
 
Amounts remaining_
 
Issue const & issue_in_
 
Issue const & issue_out_
 
const Rate m_rate_in
 
const Rate m_rate_out
 
CrossType cross_type_
 

Detailed Description

State for the active party during order book or payment operations.

Definition at line 39 of file Taker.h.

Constructor & Destructor Documentation

◆ BasicTaker() [1/3]

ripple::BasicTaker::BasicTaker ( )
delete

◆ BasicTaker() [2/3]

ripple::BasicTaker::BasicTaker ( BasicTaker const &  )
delete

◆ BasicTaker() [3/3]

ripple::BasicTaker::BasicTaker ( CrossType  cross_type,
AccountID const &  account,
Amounts const &  amount,
Quality const &  quality,
std::uint32_t  flags,
Rate const &  rate_in,
Rate const &  rate_out,
beast::Journal  journal = beast::Journal{beast::Journal::getNullSink()} 
)

Definition at line 35 of file Taker.cpp.

◆ ~BasicTaker()

virtual ripple::BasicTaker::~BasicTaker ( )
virtualdefault

Member Function Documentation

◆ log_flow()

void ripple::BasicTaker::log_flow ( char const *  description,
Flow const &  flow 
)
private

Definition at line 192 of file Taker.cpp.

◆ flow_xrp_to_iou()

BasicTaker::Flow ripple::BasicTaker::flow_xrp_to_iou ( Amounts const &  offer,
Quality  quality,
STAmount const &  owner_funds,
STAmount const &  taker_funds,
Rate const &  rate_out 
)
private

Definition at line 214 of file Taker.cpp.

◆ flow_iou_to_xrp()

BasicTaker::Flow ripple::BasicTaker::flow_iou_to_xrp ( Amounts const &  offer,
Quality  quality,
STAmount const &  owner_funds,
STAmount const &  taker_funds,
Rate const &  rate_in 
)
private

Definition at line 268 of file Taker.cpp.

◆ flow_iou_to_iou()

BasicTaker::Flow ripple::BasicTaker::flow_iou_to_iou ( Amounts const &  offer,
Quality  quality,
STAmount const &  owner_funds,
STAmount const &  taker_funds,
Rate const &  rate_in,
Rate const &  rate_out 
)
private

Definition at line 325 of file Taker.cpp.

◆ effective_rate()

Rate ripple::BasicTaker::effective_rate ( Rate const &  rate,
Issue const &  issue,
AccountID const &  from,
AccountID const &  to 
)
staticprivate

Definition at line 83 of file Taker.cpp.

◆ in_rate()

Rate ripple::BasicTaker::in_rate ( AccountID const &  from,
AccountID const &  to 
) const
private

Definition at line 129 of file Taker.h.

◆ out_rate()

Rate ripple::BasicTaker::out_rate ( AccountID const &  from,
AccountID const &  to 
) const
private

Definition at line 136 of file Taker.h.

◆ remaining_offer()

Amounts ripple::BasicTaker::remaining_offer ( ) const

Returns the amount remaining on the offer.

This is the amount at which the offer should be placed. It may either be for the full amount when there were no crossing offers, or for zero when the offer fully crossed, or any amount in between. It is always at the original offer quality (quality_)

Definition at line 141 of file Taker.cpp.

◆ original_offer()

Amounts const & ripple::BasicTaker::original_offer ( ) const

Returns the amount that the offer was originally placed at.

Definition at line 170 of file Taker.cpp.

◆ account()

AccountID const& ripple::BasicTaker::account ( ) const
noexcept

Returns the account identifier of the taker.

Definition at line 172 of file Taker.h.

◆ reject()

bool ripple::BasicTaker::reject ( Quality const &  quality) const
noexcept

Returns true if the quality does not meet the taker's requirements.

Definition at line 179 of file Taker.h.

◆ cross_type()

CrossType ripple::BasicTaker::cross_type ( ) const

Returns the type of crossing that is being performed.

Definition at line 186 of file Taker.h.

◆ issue_in()

Issue const& ripple::BasicTaker::issue_in ( ) const

Returns the Issue associated with the input of the offer.

Definition at line 193 of file Taker.h.

◆ issue_out()

Issue const& ripple::BasicTaker::issue_out ( ) const

Returns the Issue associated with the output of the offer.

Definition at line 200 of file Taker.h.

◆ unfunded()

bool ripple::BasicTaker::unfunded ( ) const

Returns true if the taker has run out of funds.

Definition at line 102 of file Taker.cpp.

◆ done()

bool ripple::BasicTaker::done ( ) const

Returns true if order crossing should not continue.

Order processing is stopped if the taker's order quantities have been reached, or if the taker has run out of input funds.

Definition at line 112 of file Taker.cpp.

◆ do_cross() [1/2]

BasicTaker::Flow ripple::BasicTaker::do_cross ( Amounts  offer,
Quality  quality,
AccountID const &  owner 
)

Perform direct crossing through given offer.

Returns
an Amounts describing the flow achieved during cross

Definition at line 385 of file Taker.cpp.

◆ do_cross() [2/2]

std::pair< BasicTaker::Flow, BasicTaker::Flow > ripple::BasicTaker::do_cross ( Amounts  offer1,
Quality  quality1,
AccountID const &  owner1,
Amounts  offer2,
Quality  quality2,
AccountID const &  owner2 
)

Perform bridged crossing through given offers.

Returns
a pair of Amounts describing the flow achieved during cross

Definition at line 434 of file Taker.cpp.

◆ get_funds()

virtual STAmount ripple::BasicTaker::get_funds ( AccountID const &  account,
STAmount const &  funds 
) const
pure virtual

Member Data Documentation

◆ account_

AccountID ripple::BasicTaker::account_
private

Definition at line 42 of file Taker.h.

◆ quality_

Quality ripple::BasicTaker::quality_
private

Definition at line 43 of file Taker.h.

◆ threshold_

Quality ripple::BasicTaker::threshold_
private

Definition at line 44 of file Taker.h.

◆ sell_

bool ripple::BasicTaker::sell_
private

Definition at line 46 of file Taker.h.

◆ original_

const Amounts ripple::BasicTaker::original_
private

Definition at line 49 of file Taker.h.

◆ remaining_

Amounts ripple::BasicTaker::remaining_
private

Definition at line 52 of file Taker.h.

◆ issue_in_

Issue const& ripple::BasicTaker::issue_in_
private

Definition at line 55 of file Taker.h.

◆ issue_out_

Issue const& ripple::BasicTaker::issue_out_
private

Definition at line 56 of file Taker.h.

◆ m_rate_in

const Rate ripple::BasicTaker::m_rate_in
private

Definition at line 60 of file Taker.h.

◆ m_rate_out

const Rate ripple::BasicTaker::m_rate_out
private

Definition at line 61 of file Taker.h.

◆ cross_type_

CrossType ripple::BasicTaker::cross_type_
private

Definition at line 64 of file Taker.h.

◆ journal_

const beast::Journal ripple::BasicTaker::journal_
protected

Definition at line 67 of file Taker.h.