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