20#include <xrpl/protocol/AMMCore.h>
21#include <xrpl/protocol/Feature.h>
22#include <xrpl/protocol/Rules.h>
23#include <xrpl/protocol/STAmount.h>
24#include <xrpl/protocol/STObject.h>
25#include <xrpl/protocol/digest.h>
36 auto const hash =
sha512Half(prefix, parentHash, ammID);
37 rsh(hash.data(), hash.size());
49 *currency.
begin() = AMMCurrencyCode;
51 hash.begin(), hash.begin() + currency.
size() - 1, currency.
begin() + 1);
73 if (pair && issue != pair->first && issue != pair->second)
101 if (amount < beast::zero || (!validZero && amount == beast::zero))
111 auto const expiration = auctionSlot[sfExpiration];
114 "ripple::ammAuctionTimeSlot : minimum expiration");
130 return rules.
enabled(featureAMM) && rules.
enabled(fixUniversalNumber);
A currency issued by an account.
Rules controlling protocol behavior.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Issue const & issue() const
static constexpr std::size_t size()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
NotTEC invalidAMMAmount(STAmount const &amount, std::optional< std::pair< Issue, Issue > > const &pair=std::nullopt, bool validZero=false)
Validate the amount.
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...
std::uint32_t constexpr TOTAL_TIME_SLOT_SECS
bool isXRP(AccountID const &c)
std::optional< std::uint8_t > ammAuctionTimeSlot(std::uint64_t current, STObject const &auctionSlot)
Get time slot of the auction slot.
NotTEC invalidAMMAsset(Issue const &issue, std::optional< std::pair< Issue, Issue > > const &pair=std::nullopt)
Currency ammLPTCurrency(Currency const &cur1, Currency const &cur2)
Calculate Liquidity Provider Token (LPT) Currency.
bool ammEnabled(Rules const &)
Return true if required AMM amendments are enabled.
Issue ammLPTIssue(Currency const &cur1, Currency const &cur2, AccountID const &ammAccountID)
Calculate LPT Issue from AMM asset pair.
@ current
This was a new validation and was added.
AccountID ammAccountID(std::uint16_t prefix, uint256 const &parentHash, uint256 const &ammID)
Calculate AMM account ID.
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
NotTEC invalidAMMAssetPair(Issue const &issue1, Issue const &issue2, std::optional< std::pair< Issue, Issue > > const &pair=std::nullopt)
std::uint32_t constexpr AUCTION_SLOT_INTERVAL_DURATION
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
TERSubset< CanCvtToNotTEC > NotTEC
Returns the RIPEMD-160 digest of the SHA256 hash of the message.