20#ifndef RIPPLE_APP_AMMOFFER_H_INCLUDED
21#define RIPPLE_APP_AMMOFFER_H_INCLUDED
23#include <xrpld/ledger/ApplyView.h>
24#include <xrpld/ledger/View.h>
26#include <xrpl/protocol/Quality.h>
27#include <xrpl/protocol/TER.h>
31template <
typename TIn,
typename TOut>
39template <
typename TIn,
typename TOut>
65 TAmounts<TIn, TOut>
const& amounts,
66 TAmounts<TIn, TOut>
const& balances,
87 TAmounts<TIn, TOut>
const&
105 TAmounts<TIn, TOut>
const& offrAmt,
114 limitIn(TAmounts<TIn, TOut>
const& offrAmt, TIn
const& limit,
bool roundUp)
122 template <
typename... Args>
140 return {ofrInRate, QUALITY_ONE};
A generic endpoint for log messages.
AMMLiquidity class provides AMM offers to BookStep class.
Represents synthetic AMM offer in BookStep.
static TER send(Args &&... args)
Send funds without incurring the transfer fee.
AccountID const & owner() const
TAmounts< TIn, TOut > limitOut(TAmounts< TIn, TOut > const &offrAmt, TOut const &limit, bool roundUp) const
Limit out of the provided offer.
static std::pair< std::uint32_t, std::uint32_t > adjustRates(std::uint32_t ofrInRate, std::uint32_t ofrOutRate)
AMMLiquidity< TIn, TOut > const & ammLiquidity_
Quality quality() const noexcept
bool checkInvariant(TAmounts< TIn, TOut > const &consumed, beast::Journal j) const
Check the new pool product is greater or equal to the old pool product or if decreases then within so...
void consume(ApplyView &view, TAmounts< TIn, TOut > const &consumed)
TAmounts< TIn, TOut > limitIn(TAmounts< TIn, TOut > const &offrAmt, TIn const &limit, bool roundUp) const
Limit in of the provided offer.
std::optional< uint256 > key() const
TAmounts< TIn, TOut > const balances_
TAmounts< TIn, TOut > const amounts_
bool fully_consumed() const
Issue const & issueIn() const
TAmounts< TIn, TOut > const & amount() const
QualityFunction getQualityFunc() const
Writeable view to a ledger, for applying a transaction.
A currency issued by an account.
Average quality of a path as a function of out: q(out) = m * out + b, where m = -1 / poolGets,...
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
TER accountSend(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee)
Calls static accountSendIOU if saAmount represents Issue.