20#ifndef RIPPLE_APP_BOOK_TAKER_H_INCLUDED
21#define RIPPLE_APP_BOOK_TAKER_H_INCLUDED
23#include <xrpld/app/tx/detail/Offer.h>
24#include <xrpld/ledger/View.h>
26#include <xrpl/beast/utility/Journal.h>
27#include <xrpl/protocol/Quality.h>
28#include <xrpl/protocol/Rate.h>
29#include <xrpl/protocol/TER.h>
30#include <xrpl/protocol/TxFlags.h>
83 return order.in >= zero &&
order.out >= zero &&
98 Rate const& rate_out);
102 Amounts
const&
offer,
106 Rate const& rate_in);
110 Amounts
const&
offer,
115 Rate const& rate_out);
147 Amounts
const& amount,
148 Quality
const& quality,
151 Rate const& rate_out,
178 reject(Quality
const& quality)
const noexcept
249 Amounts
const&
offer,
A generic endpoint for log messages.
static Sink & getNullSink()
Returns a Sink which does nothing.
Writeable view to a ledger, for applying a transaction.
State for the active party during order book or payment operations.
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)
bool done() const
Returns true if order crossing should not continue.
Rate in_rate(AccountID const &from, AccountID const &to) const
Flow flow_iou_to_xrp(Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_in)
BasicTaker(BasicTaker const &)=delete
Flow flow_xrp_to_iou(Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_out)
beast::Journal const journal_
CrossType cross_type() const
Returns the type of crossing that is being performed.
AccountID const & account() const noexcept
Returns the account identifier of the taker.
bool reject(Quality const &quality) const noexcept
Returns true if the quality does not meet the taker's requirements.
void log_flow(char const *description, Flow const &flow)
Issue const & issue_in() const
Returns the Issue associated with the input of the offer.
Amounts remaining_offer() const
Returns the amount remaining on the offer.
Rate out_rate(AccountID const &from, AccountID const &to) const
Amounts const & original_offer() const
Returns the amount that the offer was originally placed at.
Issue const & issue_out() const
Returns the Issue associated with the output of the offer.
virtual ~BasicTaker()=default
virtual STAmount get_funds(AccountID const &account, STAmount const &funds) const =0
static Rate effective_rate(Rate const &rate, Issue const &issue, AccountID const &from, AccountID const &to)
BasicTaker::Flow do_cross(Amounts offer, Quality quality, AccountID const &owner)
Perform direct crossing through given offer.
bool unfunded() const
Returns true if the taker has run out of funds.
A currency issued by an account.
STAmount get_funds(AccountID const &account, STAmount const &funds) const override
TER issueIOU(AccountID const &account, STAmount const &amount, Issue const &issue)
static Rate calculateRate(ApplyView const &view, AccountID const &issuer, AccountID const &account)
std::uint32_t direct_crossings_
std::uint32_t get_bridge_crossings() const
std::uint32_t get_direct_crossings() const
TER redeemIOU(AccountID const &account, STAmount const &amount, Issue const &issue)
STAmount const & get_xrp_flow() const
Taker(Taker const &)=delete
std::uint32_t bridge_crossings_
TER fill(BasicTaker::Flow const &flow, Offer &offer)
TER transferXRP(AccountID const &from, AccountID const &to, STAmount const &amount)
void consume_offer(Offer &offer, Amounts const &order)
TER cross(Offer &offer)
Perform a direct or bridged offer crossing as appropriate.
Json::Value rate(Account const &account, double multiplier)
Set a transfer rate.
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool isXRP(AccountID const &c)
StrandResult< TInAmt, TOutAmt > flow(PaymentSandbox const &baseView, Strand const &strand, std::optional< TInAmt > const &maxIn, TOutAmt const &out, beast::Journal j)
Request out amount from a strand.
CrossType
The flavor of an offer crossing.
bool sanity_check() const
Represents a transfer rate.