20#include <xrpld/app/ledger/OrderBookDB.h>
21#include <xrpld/app/misc/PermissionedDEXHelpers.h>
22#include <xrpld/app/paths/Flow.h>
23#include <xrpld/app/tx/detail/CreateOffer.h>
24#include <xrpld/ledger/PaymentSandbox.h>
26#include <xrpl/basics/base_uint.h>
27#include <xrpl/beast/utility/WrappedSink.h>
28#include <xrpl/protocol/Feature.h>
29#include <xrpl/protocol/Quality.h>
30#include <xrpl/protocol/STAmount.h>
31#include <xrpl/protocol/TER.h>
32#include <xrpl/protocol/st.h>
39 auto const& amount{tx[sfTakerGets]};
40 return amount.native() ? amount.xrp() : beast::zero;
63 JLOG(j.debug()) <<
"Malformed transaction: Invalid flags set.";
70 if (tx.isFlag(
tfHybrid) && !tx.isFieldPresent(sfDomainID))
76 if (bImmediateOrCancel && bFillOrKill)
78 JLOG(j.debug()) <<
"Malformed transaction: both IoC and FoK set.";
82 bool const bHaveExpiration(tx.isFieldPresent(sfExpiration));
84 if (bHaveExpiration && (tx.getFieldU32(sfExpiration) == 0))
86 JLOG(j.debug()) <<
"Malformed offer: bad expiration";
90 if (
auto const cancelSequence = tx[~sfOfferSequence];
91 cancelSequence && *cancelSequence == 0)
93 JLOG(j.debug()) <<
"Malformed offer: bad cancel sequence";
97 STAmount saTakerPays = tx[sfTakerPays];
98 STAmount saTakerGets = tx[sfTakerGets];
105 JLOG(j.debug()) <<
"Malformed offer: redundant (XRP for XRP)";
108 if (saTakerPays <= beast::zero || saTakerGets <= beast::zero)
110 JLOG(j.debug()) <<
"Malformed offer: bad amount";
114 auto const& uPaysIssuerID = saTakerPays.
getIssuer();
115 auto const& uPaysCurrency = saTakerPays.
getCurrency();
117 auto const& uGetsIssuerID = saTakerGets.
getIssuer();
118 auto const& uGetsCurrency = saTakerGets.
getCurrency();
120 if (uPaysCurrency == uGetsCurrency && uPaysIssuerID == uGetsIssuerID)
122 JLOG(j.debug()) <<
"Malformed offer: redundant (IOU for IOU)";
128 JLOG(j.debug()) <<
"Malformed offer: bad currency";
132 if (saTakerPays.
native() != !uPaysIssuerID ||
133 saTakerGets.
native() != !uGetsIssuerID)
135 JLOG(j.debug()) <<
"Malformed offer: bad issuer";
145 auto const id = ctx.
tx[sfAccount];
147 auto saTakerPays = ctx.
tx[sfTakerPays];
148 auto saTakerGets = ctx.
tx[sfTakerGets];
150 auto const& uPaysIssuerID = saTakerPays.getIssuer();
151 auto const& uPaysCurrency = saTakerPays.getCurrency();
153 auto const& uGetsIssuerID = saTakerGets.getIssuer();
155 auto const cancelSequence = ctx.
tx[~sfOfferSequence];
161 std::uint32_t const uAccountSequence = sleCreator->getFieldU32(sfSequence);
168 JLOG(ctx.
j.
debug()) <<
"Offer involves frozen asset";
176 <<
"delay: Offers must be at least partially funded.";
182 if (cancelSequence && (uAccountSequence <= *cancelSequence))
184 JLOG(ctx.
j.
debug()) <<
"uAccountSequenceNext=" << uAccountSequence
185 <<
" uOfferSequence=" << *cancelSequence;
203 if (!saTakerPays.native())
210 Issue(uPaysCurrency, uPaysIssuerID));
220 ctx.
view,
id, ctx.
tx[sfDomainID]))
238 "ripple::CreateOffer::checkAcceptAsset : input is not XRP");
245 <<
"delay: can't receive IOUs from non-existent issuer: "
260 auto const trustLine =
271 bool const canonical_gt(
id > issue.
account);
273 bool const is_authorized(
279 <<
"delay: can't receive IOUs from issuer without auth.";
293 auto const trustLine =
303 bool const deepFrozen =
317 if (offer.fully_consumed())
325 return (amount <= beast::zero);
338 have_direct || have_bridge,
339 "ripple::CreateOffer::select_path : valid inputs");
345 Quality
const bridged_quality(
352 Quality
const direct_quality(direct.
tip().
quality());
354 if (bridged_quality < direct_quality)
366 auto const crossings =
371 return crossings >= 850;
384 !
isXRP(takerAmount.in) && !
isXRP(takerAmount.out),
385 "ripple::CreateOffer::bridged_cross : neither is XRP");
387 if (
isXRP(takerAmount.in) ||
isXRP(takerAmount.out))
388 Throw<std::logic_error>(
"Bridging with XRP and an endpoint.");
419 bool have_bridge = offers_leg1.
step() && offers_leg2.
step();
427 while (have_direct || have_bridge)
429 bool leg1_consumed =
false;
430 bool leg2_consumed =
false;
431 bool direct_consumed =
false;
434 have_direct, offers_direct, have_bridge, offers_leg1, offers_leg2);
438 if (taker.
reject(quality))
447 stream << count <<
" Direct:";
448 stream <<
" offer: " << offers_direct.
tip();
449 stream <<
" in: " << offers_direct.
tip().
amount().in;
450 stream <<
" out: " << offers_direct.
tip().
amount().out;
451 stream <<
" owner: " << offers_direct.
tip().
owner();
461 cross_result = taker.
cross(offers_direct.
tip());
467 direct_consumed =
true;
489 stream << count <<
" Bridge:";
490 stream <<
" offer1: " << offers_leg1.
tip();
491 stream <<
" in: " << offers_leg1.
tip().
amount().in;
492 stream <<
" out: " << offers_leg1.
tip().
amount().out;
493 stream <<
" owner: " << offers_leg1.
tip().
owner();
494 stream <<
" funds: " << owner1_funds_before;
495 stream <<
" offer2: " << offers_leg2.
tip();
496 stream <<
" in: " << offers_leg2.
tip().
amount().in;
497 stream <<
" out: " << offers_leg2.
tip().
amount().out;
498 stream <<
" owner: " << offers_leg2.
tip().
owner();
499 stream <<
" funds: " << owner2_funds_before;
502 cross_result = taker.
cross(offers_leg1.
tip(), offers_leg2.
tip());
512 have_bridge &= offers_leg1.
step();
516 have_bridge &= offers_leg2.
step();
524 leg1_consumed =
true;
525 have_bridge = (have_bridge && offers_leg1.
step());
529 leg2_consumed =
true;
530 have_bridge = (have_bridge && offers_leg2.
step());
543 JLOG(
j_.
debug()) <<
"The taker reports he's done during crossing!";
549 JLOG(
j_.
debug()) <<
"The offer crossing limit has been exceeded!";
556 direct_consumed || leg1_consumed || leg2_consumed,
557 "ripple::CreateOffer::bridged_cross : consumed an offer");
559 if (!direct_consumed && !leg1_consumed && !leg2_consumed)
560 Throw<std::logic_error>(
561 "bridged crossing: nothing was fully consumed.");
591 bool direct_consumed =
false;
592 auto& offer(offers.tip());
595 if (taker.
reject(offer.quality()))
602 stream << count <<
" Direct:";
603 stream <<
" offer: " << offer;
604 stream <<
" in: " << offer.amount().in;
605 stream <<
" out: " << offer.amount().out;
606 stream <<
"quality: " << offer.quality();
607 stream <<
" owner: " << offer.owner();
617 cross_result = taker.
cross(offer);
623 direct_consumed =
true;
635 JLOG(
j_.
debug()) <<
"The taker reports he's done during crossing!";
641 JLOG(
j_.
debug()) <<
"The offer crossing limit has been exceeded!";
649 "ripple::CreateOffer::direct_cross : consumed an offer");
651 if (!direct_consumed)
652 Throw<std::logic_error>(
653 "direct crossing: nothing was fully consumed.");
665 while (stream.step())
667 auto const& offer = stream.tip();
670 if (taker.
reject(offer.quality()))
674 if (offer.owner() != taker.
account())
686 Amounts
const& takerAmount,
699 if (inStartBalance <= beast::zero)
702 JLOG(
j_.
debug()) <<
"Not crossing: taker is unfunded.";
709 Rate gatewayXferRate{QUALITY_ONE};
714 if (gatewayXferRate.value != QUALITY_ONE)
719 takerAmount.in.issue(),
726 Quality threshold{takerAmount.out, sendMax};
735 if (sendMax > inStartBalance)
736 sendMax = inStartBalance;
743 if (!takerAmount.in.native() && !takerAmount.out.native())
746 path.emplace_back(std::nullopt,
xrpCurrency(), std::nullopt);
766 takerAmount.out.
issue(),
772 auto const result =
flow(
788 for (
auto const& toRemove : result.removableOffers)
797 auto afterCross = takerAmount;
803 if (takerInBalance <= beast::zero)
807 afterCross.in.clear();
808 afterCross.out.clear();
813 Quality{takerAmount.out, takerAmount.in}.rate()};
825 STAmount nonGatewayAmountIn = result.actualAmountIn;
826 if (gatewayXferRate.value != QUALITY_ONE)
828 result.actualAmountIn,
830 takerAmount.in.issue(),
833 afterCross.in -= nonGatewayAmountIn;
837 if (afterCross.in < beast::zero)
840 afterCross.in.
clear();
842 afterCross.out = [&]() {
852 takerAmount.out.issue(),
856 afterCross.in, rate, takerAmount.out.issue(),
true);
864 afterCross.out -= result.actualAmountOut;
866 afterCross.out >= beast::zero,
867 "ripple::CreateOffer::flowCross : minimum offer");
868 if (afterCross.out < beast::zero)
869 afterCross.out.clear();
871 afterCross.out, rate, takerAmount.in.issue(),
true);
881 JLOG(
j_.
error()) <<
"Exception during offer crossing: " << e.
what();
890 Amounts
const& takerAmount,
895 auto const ret =
flowCross(psbFlow, psbCancelFlow, takerAmount, domainID);
897 psbCancelFlow.apply(sbCancel);
916 if (pays_xrp && !gets_xrp)
918 else if (gets_xrp && !pays_xrp)
933 if (!sleOffer->isFieldPresent(sfDomainID))
940 Book const book{saTakerPays.
issue(), saTakerGets.
issue(), std::nullopt};
944 bool const bookExists = sb.
exists(dir);
949 setDir(sle, std::nullopt);
955 <<
"final result: failed to add hybrid offer to open book";
959 STArray bookArr(sfAdditionalBooks, 1);
961 bookInfo.setFieldH256(sfBookDirectory, dir.key);
962 bookInfo.setFieldU64(sfBookNode, *bookNode);
968 sleOffer->setFieldArray(sfAdditionalBooks, bookArr);
979 bool const bPassive(uTxFlags &
tfPassive);
982 bool const bSell(uTxFlags &
tfSell);
983 bool const bHybrid(uTxFlags &
tfHybrid);
985 auto saTakerPays =
ctx_.
tx[sfTakerPays];
986 auto saTakerGets =
ctx_.
tx[sfTakerGets];
987 auto const domainID =
ctx_.
tx[~sfDomainID];
989 auto const cancelSequence =
ctx_.
tx[~sfOfferSequence];
998 auto uRate =
getRate(saTakerGets, saTakerPays);
1007 auto const sleCancel =
1015 JLOG(
j_.
debug()) <<
"Create cancels order " << *cancelSequence;
1020 auto const expiration =
ctx_.
tx[~sfExpiration];
1035 bool const bOpenLedger = sb.
open();
1036 bool crossed =
false;
1041 auto const& uPaysIssuerID = saTakerPays.
getIssuer();
1042 auto const& uGetsIssuerID = saTakerGets.
getIssuer();
1045 if (!
isXRP(uPaysIssuerID))
1048 if (sle && sle->isFieldPresent(sfTickSize))
1049 uTickSize =
std::min(uTickSize, (*sle)[sfTickSize]);
1051 if (!
isXRP(uGetsIssuerID))
1054 if (sle && sle->isFieldPresent(sfTickSize))
1055 uTickSize =
std::min(uTickSize, (*sle)[sfTickSize]);
1057 if (uTickSize < Quality::maxTickSize)
1060 Quality{saTakerGets, saTakerPays}.round(uTickSize).rate();
1068 saTakerPays =
multiply(saTakerGets, rate, saTakerPays.
issue());
1073 saTakerGets =
divide(saTakerPays, rate, saTakerGets.
issue());
1075 if (!saTakerGets || !saTakerPays)
1077 JLOG(
j_.
debug()) <<
"Offer rounded to zero";
1078 return {result,
true};
1081 uRate =
getRate(saTakerGets, saTakerPays);
1085 Amounts
const takerAmount(saTakerGets, saTakerPays);
1090 Amounts place_offer;
1092 JLOG(
j_.
debug()) <<
"Attempting cross: "
1093 <<
to_string(takerAmount.in.issue()) <<
" -> "
1098 stream <<
" mode: " << (bPassive ?
"passive " :
"")
1099 << (bSell ?
"sell" :
"buy");
1105 cross(sb, sbCancel, takerAmount, domainID);
1111 "ripple::CreateOffer::applyGuts : result is tesSUCCESS or "
1116 stream <<
"Cross result: " <<
transToken(result);
1127 return {result,
true};
1131 saTakerGets.
issue() == place_offer.in.issue(),
1132 "ripple::CreateOffer::applyGuts : taker gets issue match");
1134 saTakerPays.
issue() == place_offer.out.issue(),
1135 "ripple::CreateOffer::applyGuts : taker pays issue match");
1137 if (takerAmount != place_offer)
1142 if (place_offer.in < zero || place_offer.out < zero)
1144 JLOG(
j_.
fatal()) <<
"Cross left offer negative!"
1150 if (place_offer.in == zero || place_offer.out == zero)
1152 JLOG(
j_.
debug()) <<
"Offer fully crossed!";
1153 return {result,
true};
1159 saTakerPays = place_offer.out;
1160 saTakerGets = place_offer.in;
1164 saTakerPays > zero && saTakerGets > zero,
1165 "ripple::CreateOffer::applyGuts : taker pays and gets positive");
1170 return {result,
true};
1175 stream <<
"Place" << (crossed ?
" remaining " :
" ") <<
"offer:";
1184 JLOG(
j_.
trace()) <<
"Fill or Kill: offer killed";
1192 if (bImmediateOrCancel)
1194 JLOG(
j_.
trace()) <<
"Immediate or cancel: offer canceled";
1195 if (!crossed && sb.
rules().
enabled(featureImmediateOfferKilled))
1225 return {result,
true};
1239 <<
"final result: failed to add offer to owner's directory";
1248 << (domainID ? (
" : " +
to_string(*domainID)) :
"");
1250 Book const book{saTakerPays.
issue(), saTakerGets.
issue(), domainID};
1264 bool const bookExisted =
static_cast<bool>(sb.
peek(dir));
1266 auto setBookDir = [&](
SLE::ref sle,
1268 sle->setFieldH160(sfTakerPaysCurrency, saTakerPays.
issue().
currency);
1269 sle->setFieldH160(sfTakerPaysIssuer, saTakerPays.
issue().
account);
1270 sle->setFieldH160(sfTakerGetsCurrency, saTakerGets.
issue().
currency);
1271 sle->setFieldH160(sfTakerGetsIssuer, saTakerGets.
issue().
account);
1272 sle->setFieldU64(sfExchangeRate, uRate);
1274 sle->setFieldH256(sfDomainID, *maybeDomain);
1279 setBookDir(sle, domainID);
1284 JLOG(
j_.
debug()) <<
"final result: failed to add offer to book";
1288 auto sleOffer = std::make_shared<SLE>(offer_index);
1289 sleOffer->setAccountID(sfAccount,
account_);
1290 sleOffer->setFieldU32(sfSequence, offerSequence);
1291 sleOffer->setFieldH256(sfBookDirectory, dir.key);
1292 sleOffer->setFieldAmount(sfTakerPays, saTakerPays);
1293 sleOffer->setFieldAmount(sfTakerGets, saTakerGets);
1294 sleOffer->setFieldU64(sfOwnerNode, *ownerNode);
1295 sleOffer->setFieldU64(sfBookNode, *bookNode);
1297 sleOffer->setFieldU32(sfExpiration, *expiration);
1303 sleOffer->setFieldH256(sfDomainID, *domainID);
1309 sb, sleOffer, offer_index, saTakerPays, saTakerGets, setBookDir);
1319 JLOG(
j_.
debug()) <<
"final result: success";
1336 auto const result =
applyGuts(sb, sbCancel);
1341 return result.first;
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
virtual beast::Journal journal(std::string const &name)=0
virtual OrderBookDB & getOrderBookDB()=0
Writeable view to a ledger, for applying a transaction.
std::optional< std::uint64_t > dirAppend(Keylet const &directory, Keylet const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Append an entry to a directory.
std::optional< std::uint64_t > dirInsert(Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Insert an entry to a directory.
bool done() const
Returns true if order crossing should not continue.
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.
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.
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.
std::pair< TER, Amounts > flowCross(PaymentSandbox &psb, PaymentSandbox &psbCancel, Amounts const &takerAmount, std::optional< uint256 > const &domainID)
std::pair< TER, Amounts > bridged_cross(Taker &taker, ApplyView &view, ApplyView &view_cancel, NetClock::time_point const when)
OfferStream::StepCounter stepCounter_
static TER checkAcceptAsset(ReadView const &view, ApplyFlags const flags, AccountID const id, beast::Journal const j, Issue const &issue)
void preCompute() override
Gather information beyond what the Transactor base class gathers.
bool dry_offer(ApplyView &view, Offer const &offer)
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
static bool step_account(OfferStream &stream, Taker const &taker)
static std::string format_amount(STAmount const &amount)
bool reachedOfferCrossingLimit(Taker const &taker) const
std::pair< TER, Amounts > direct_cross(Taker &taker, ApplyView &view, ApplyView &view_cancel, NetClock::time_point const when)
static NotTEC preflight(PreflightContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
TER applyHybrid(Sandbox &sb, std::shared_ptr< STLedgerEntry > sleOffer, Keylet const &offer_index, STAmount const &saTakerPays, STAmount const &saTakerGets, std::function< void(SLE::ref, std::optional< uint256 >)> const &setDir)
TER doApply() override
Precondition: fee collection is likely.
std::pair< TER, bool > applyGuts(Sandbox &view, Sandbox &view_cancel)
static std::pair< bool, Quality > select_path(bool have_direct, OfferStream const &direct, bool have_bridge, OfferStream const &leg1, OfferStream const &leg2)
std::pair< TER, Amounts > cross(Sandbox &sb, Sandbox &sbCancel, Amounts const &takerAmount, std::optional< uint256 > const &domainID)
A currency issued by an account.
Presents and consumes the offers in an order book.
void addOrderBook(Book const &)
A wrapper which makes credits unavailable to balances.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual Rules const & rules() const =0
Returns the tx processing rules.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
static int const cMaxOffset
Currency const & getCurrency() const
static std::uint64_t const cMaxValue
std::string getText() const override
AccountID const & getIssuer() const
Issue const & issue() const
static std::uint64_t const cMaxNative
std::string getFullText() const override
bool native() const noexcept
void push_back(STObject const &object)
STAmount const & getFieldAmount(SField const &field) const
bool isFieldPresent(SField const &field) const
static STObject makeInnerObject(SField const &name)
std::uint32_t getFlags() const
void emplace_back(Args &&... args)
std::uint32_t getSeqValue() const
Returns the first non-zero value of (Sequence, TicketSequence).
Discardable, editable view to a ledger.
bool step()
Advance to the next valid offer.
TOffer< TIn, TOut > & tip() const
Returns the offer at the tip of the order book.
Quality quality() const noexcept
Returns the quality of the offer.
AccountID const & owner() const
Returns the account id of the offer's owner.
TAmounts< TIn, TOut > const & amount() const
Returns the in and out amounts.
std::uint32_t get_bridge_crossings() const
std::uint32_t get_direct_crossings() const
TER cross(Offer &offer)
Perform a direct or bridged offer crossing as appropriate.
virtual void preCompute()
Class describing the consequences to the account of applying a transaction if the transaction consume...
Fees const & fees() const override
Returns the fees for the base ledger.
bool open() const override
Returns true if this reflects an open ledger.
void insert(std::shared_ptr< SLE > const &sle) override
Insert a new state SLE.
bool exists(Keylet const &k) const override
Determine if a state item exists.
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
Rules const & rules() const override
Returns the tx processing rules.
std::shared_ptr< SLE > peek(Keylet const &k) override
Prepare to modify the SLE associated with key.
Keylet quality(Keylet const &k, std::uint64_t q) noexcept
The initial directory page for a specific quality.
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
bool accountInDomain(ReadView const &view, AccountID const &account, Domain const &domainID)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
STAmount divide(STAmount const &amount, Rate const &rate)
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...
STAmount accountFunds(ReadView const &view, AccountID const &id, STAmount const &saDefault, FreezeHandling freezeHandling, beast::Journal j)
bool isXRP(AccountID const &c)
constexpr std::uint32_t tfOfferCreateMask
STAmount divRoundStrict(STAmount const &v1, STAmount const &v2, Asset const &asset, bool roundUp)
bool isLegalNet(STAmount const &value)
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
constexpr std::uint32_t tfHybrid
STAmount multiply(STAmount const &amount, Rate const &rate)
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
constexpr std::uint32_t tfFillOrKill
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
STAmount divideRound(STAmount const &amount, Rate const &rate, bool roundUp)
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.
constexpr std::uint32_t tfPassive
constexpr std::uint32_t tfImmediateOrCancel
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
Quality composed_quality(Quality const &lhs, Quality const &rhs)
static bool adjustOwnerCount(ApplyContext &ctx, int count)
std::string transToken(TER code)
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
Currency const & xrpCurrency()
XRP currency.
bool isTesSuccess(TER x) noexcept
STAmount divRound(STAmount const &v1, STAmount const &v2, Asset const &asset, bool roundUp)
std::string to_string(base_uint< Bits, Tag > const &a)
STAmount mulRound(STAmount const &v1, STAmount const &v2, Asset const &asset, bool roundUp)
STAmount multiplyRound(STAmount const &amount, Rate const &rate, bool roundUp)
constexpr std::uint32_t tfSell
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
bool isTecClaim(TER x) noexcept
bool isGlobalFrozen(ReadView const &view, AccountID const &issuer)
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
A pair of SHAMap key and LedgerEntryType.
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.
Represents a transfer rate.