20 #ifndef RIPPLE_APP_BOOK_TAKER_H_INCLUDED
21 #define RIPPLE_APP_BOOK_TAKER_H_INCLUDED
23 #include <ripple/app/tx/impl/Offer.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <ripple/core/Config.h>
26 #include <ripple/ledger/View.h>
27 #include <ripple/protocol/Quality.h>
28 #include <ripple/protocol/Rate.h>
29 #include <ripple/protocol/TER.h>
30 #include <ripple/protocol/TxFlags.h>
71 explicit Flow() =
default;
84 return order.in >= zero &&
order.out >= zero &&
99 Rate const& rate_out);
103 Amounts
const& offer,
107 Rate const& rate_in);
111 Amounts
const& offer,
116 Rate const& rate_out);
148 Amounts
const& amount,
149 Quality
const& quality,
152 Rate const& rate_out,
179 reject(Quality
const& quality)
const noexcept
250 Amounts
const& offer,
STAmount get_funds(AccountID const &account, STAmount const &funds) const override
A currency issued by an account.
Represents a transfer rate.
TER fill(BasicTaker::Flow const &flow, Offer &offer)
bool unfunded() const
Returns true if the taker has run out of funds.
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)
BasicTaker::Flow do_cross(Amounts offer, Quality quality, AccountID const &owner)
Perform direct crossing through given offer.
bool reject(Quality const &quality) const noexcept
Returns true if the quality does not meet the taker's requirements.
Amounts remaining_offer() const
Returns the amount remaining on the offer.
Rate in_rate(AccountID const &from, AccountID const &to) const
std::uint32_t direct_crossings_
void log_flow(char const *description, Flow const &flow)
STAmount const & get_xrp_flow() const
Issue const & issue_in() const
Returns the Issue associated with the input of the offer.
Flow flow_xrp_to_iou(Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_out)
State for the active party during order book or payment operations.
std::uint32_t get_bridge_crossings() const
std::uint32_t get_direct_crossings() const
CrossType cross_type() const
Returns the type of crossing that is being performed.
static Sink & getNullSink()
Returns a Sink which does nothing.
const beast::Journal journal_
Writeable view to a ledger, for applying a transaction.
TER redeemIOU(AccountID const &account, STAmount const &amount, Issue const &issue)
virtual ~BasicTaker()=default
Flow flow_iou_to_xrp(Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_in)
static Rate calculateRate(ApplyView const &view, AccountID const &issuer, AccountID const &account)
Issue const & issue_out() const
Returns the Issue associated with the output of the offer.
path::RippleCalc::Output flow(PaymentSandbox &view, STAmount const &deliver, AccountID const &src, AccountID const &dst, STPathSet const &paths, bool defaultPaths, bool partialPayment, bool ownerPaysTransferFee, bool offerCrossing, std::optional< Quality > const &limitQuality, std::optional< STAmount > const &sendMax, beast::Journal j, path::detail::FlowDebugInfo *flowDebugInfo=nullptr)
Make a payment from the src account to the dst account.
CrossType
The flavor of an offer crossing.
TER issueIOU(AccountID const &account, STAmount const &amount, Issue const &issue)
Amounts const & original_offer() const
Returns the amount that the offer was originally placed at.
bool isXRP(AccountID const &c)
void consume_offer(Offer &offer, Amounts const &order)
A generic endpoint for log messages.
std::uint32_t bridge_crossings_
bool sanity_check() const
static Rate effective_rate(Rate const &rate, Issue const &issue, AccountID const &from, AccountID const &to)
virtual STAmount get_funds(AccountID const &account, STAmount const &funds) const =0
bool done() const
Returns true if order crossing should not continue.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
TER transferXRP(AccountID const &from, AccountID const &to, STAmount const &amount)
AccountID const & account() const noexcept
Returns the account identifier of the taker.
TER cross(Offer &offer)
Perform a direct or bridged offer crossing as appropriate.
Rate out_rate(AccountID const &from, AccountID const &to) const
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.