rippled
Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ripple::Taker Class Reference
Inheritance diagram for ripple::Taker:
Inheritance graph
[legend]
Collaboration diagram for ripple::Taker:
Collaboration graph
[legend]

Public Member Functions

 Taker ()=delete
 
 Taker (Taker const &)=delete
 
 Taker (CrossType cross_type, ApplyView &view, AccountID const &account, Amounts const &offer, std::uint32_t flags, beast::Journal journal)
 
 ~Taker ()=default
 
void consume_offer (Offer &offer, Amounts const &order)
 
STAmount get_funds (AccountID const &account, STAmount const &funds) const override
 
STAmount const & get_xrp_flow () const
 
std::uint32_t get_direct_crossings () const
 
std::uint32_t get_bridge_crossings () const
 
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...
 
TER cross (Offer &offer)
 Perform a direct or bridged offer crossing as appropriate. More...
 
TER cross (Offer &leg1, Offer &leg2)
 

Protected Attributes

const beast::Journal journal_
 

Private Member Functions

TER fill (BasicTaker::Flow const &flow, Offer &offer)
 
TER fill (BasicTaker::Flow const &flow1, Offer &leg1, BasicTaker::Flow const &flow2, Offer &leg2)
 
TER transferXRP (AccountID const &from, AccountID const &to, STAmount const &amount)
 
TER redeemIOU (AccountID const &account, STAmount const &amount, Issue const &issue)
 
TER issueIOU (AccountID const &account, STAmount const &amount, Issue const &issue)
 
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 calculateRate (ApplyView const &view, AccountID const &issuer, AccountID const &account)
 
static Rate effective_rate (Rate const &rate, Issue const &issue, AccountID const &from, AccountID const &to)
 

Private Attributes

ApplyViewview_
 
STAmount xrp_flow_
 
std::uint32_t direct_crossings_
 
std::uint32_t bridge_crossings_
 
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

Definition at line 240 of file Taker.h.

Constructor & Destructor Documentation

◆ Taker() [1/3]

ripple::Taker::Taker ( )
delete

◆ Taker() [2/3]

ripple::Taker::Taker ( Taker const &  )
delete

◆ Taker() [3/3]

ripple::Taker::Taker ( CrossType  cross_type,
ApplyView view,
AccountID const &  account,
Amounts const &  offer,
std::uint32_t  flags,
beast::Journal  journal 
)

Definition at line 541 of file Taker.cpp.

◆ ~Taker()

ripple::Taker::~Taker ( )
default

Member Function Documentation

◆ consume_offer()

void ripple::Taker::consume_offer ( Offer offer,
Amounts const &  order 
)

Definition at line 587 of file Taker.cpp.

◆ get_funds()

STAmount ripple::Taker::get_funds ( AccountID const &  account,
STAmount const &  funds 
) const
overridevirtual

Implements ripple::BasicTaker.

Definition at line 609 of file Taker.cpp.

◆ get_xrp_flow()

STAmount const& ripple::Taker::get_xrp_flow ( ) const

Definition at line 262 of file Taker.h.

◆ get_direct_crossings()

std::uint32_t ripple::Taker::get_direct_crossings ( ) const

Definition at line 268 of file Taker.h.

◆ get_bridge_crossings()

std::uint32_t ripple::Taker::get_bridge_crossings ( ) const

Definition at line 274 of file Taker.h.

◆ cross() [1/2]

TER ripple::Taker::cross ( Offer offer)

Perform a direct or bridged offer crossing as appropriate.

Funds will be transferred accordingly, and offers will be adjusted.

Returns
tesSUCCESS if successful, or an error code otherwise.

Definition at line 789 of file Taker.cpp.

◆ cross() [2/2]

TER ripple::Taker::cross ( Offer leg1,
Offer leg2 
)

Definition at line 802 of file Taker.cpp.

◆ calculateRate()

Rate ripple::Taker::calculateRate ( ApplyView const &  view,
AccountID const &  issuer,
AccountID const &  account 
)
staticprivate

Definition at line 821 of file Taker.cpp.

◆ fill() [1/2]

TER ripple::Taker::fill ( BasicTaker::Flow const &  flow,
Offer offer 
)
private

Definition at line 683 of file Taker.cpp.

◆ fill() [2/2]

TER ripple::Taker::fill ( BasicTaker::Flow const &  flow1,
Offer leg1,
BasicTaker::Flow const &  flow2,
Offer leg2 
)
private

Definition at line 739 of file Taker.cpp.

◆ transferXRP()

TER ripple::Taker::transferXRP ( AccountID const &  from,
AccountID const &  to,
STAmount const &  amount 
)
private

Definition at line 615 of file Taker.cpp.

◆ redeemIOU()

TER ripple::Taker::redeemIOU ( AccountID const &  account,
STAmount const &  amount,
Issue const &  issue 
)
private

Definition at line 634 of file Taker.cpp.

◆ issueIOU()

TER ripple::Taker::issueIOU ( AccountID const &  account,
STAmount const &  amount,
Issue const &  issue 
)
private

Definition at line 663 of file Taker.cpp.

◆ log_flow()

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

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
staticprivateinherited

Definition at line 83 of file Taker.cpp.

◆ in_rate()

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

Definition at line 129 of file Taker.h.

◆ out_rate()

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

Definition at line 136 of file Taker.h.

◆ remaining_offer()

Amounts ripple::BasicTaker::remaining_offer ( ) const
inherited

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
inherited

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
noexceptinherited

Returns the account identifier of the taker.

Definition at line 172 of file Taker.h.

◆ reject()

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

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
inherited

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
inherited

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
inherited

Returns the Issue associated with the output of the offer.

Definition at line 200 of file Taker.h.

◆ unfunded()

bool ripple::BasicTaker::unfunded ( ) const
inherited

Returns true if the taker has run out of funds.

Definition at line 102 of file Taker.cpp.

◆ done()

bool ripple::BasicTaker::done ( ) const
inherited

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 
)
inherited

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 
)
inherited

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.

Member Data Documentation

◆ view_

ApplyView& ripple::Taker::view_
private

Definition at line 328 of file Taker.h.

◆ xrp_flow_

STAmount ripple::Taker::xrp_flow_
private

Definition at line 331 of file Taker.h.

◆ direct_crossings_

std::uint32_t ripple::Taker::direct_crossings_
private

Definition at line 334 of file Taker.h.

◆ bridge_crossings_

std::uint32_t ripple::Taker::bridge_crossings_
private

Definition at line 337 of file Taker.h.

◆ account_

AccountID ripple::BasicTaker::account_
privateinherited

Definition at line 42 of file Taker.h.

◆ quality_

Quality ripple::BasicTaker::quality_
privateinherited

Definition at line 43 of file Taker.h.

◆ threshold_

Quality ripple::BasicTaker::threshold_
privateinherited

Definition at line 44 of file Taker.h.

◆ sell_

bool ripple::BasicTaker::sell_
privateinherited

Definition at line 46 of file Taker.h.

◆ original_

const Amounts ripple::BasicTaker::original_
privateinherited

Definition at line 49 of file Taker.h.

◆ remaining_

Amounts ripple::BasicTaker::remaining_
privateinherited

Definition at line 52 of file Taker.h.

◆ issue_in_

Issue const& ripple::BasicTaker::issue_in_
privateinherited

Definition at line 55 of file Taker.h.

◆ issue_out_

Issue const& ripple::BasicTaker::issue_out_
privateinherited

Definition at line 56 of file Taker.h.

◆ m_rate_in

const Rate ripple::BasicTaker::m_rate_in
privateinherited

Definition at line 60 of file Taker.h.

◆ m_rate_out

const Rate ripple::BasicTaker::m_rate_out
privateinherited

Definition at line 61 of file Taker.h.

◆ cross_type_

CrossType ripple::BasicTaker::cross_type_
privateinherited

Definition at line 64 of file Taker.h.

◆ journal_

const beast::Journal ripple::BasicTaker::journal_
protectedinherited

Definition at line 67 of file Taker.h.