1#ifndef XRPL_APP_MISC_AMMUTILS_H_INCLUDED 
    2#define XRPL_APP_MISC_AMMUTILS_H_INCLUDED 
    4#include <xrpl/basics/Expected.h> 
    5#include <xrpl/beast/utility/Journal.h> 
    6#include <xrpl/ledger/View.h> 
    7#include <xrpl/protocol/STAmount.h> 
    8#include <xrpl/protocol/STLedgerEntry.h> 
    9#include <xrpl/protocol/TER.h> 
   33Expected<std::tuple<STAmount, STAmount, STAmount>, 
TER>
 
   95    Issue 
const& lptIssue,
 
  104    ReadView 
const& view,
 
  105    Issue 
const& ammIssue,
 
  115    STAmount 
const& lpTokens,
 
A generic endpoint for log messages.
 
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.
 
FreezeHandling
Controls the treatment of frozen account balances.
 
std::uint16_t getTradingFee(ReadView const &view, SLE const &ammSle, AccountID const &account)
Get AMM trading fee for the given account.
 
TER deleteAMMAccount(Sandbox &view, Issue const &asset, Issue const &asset2, beast::Journal j)
Delete trustlines to AMM.
 
Expected< bool, TER > isOnlyLiquidityProvider(ReadView const &view, Issue const &ammIssue, AccountID const &lpAccount)
Return true if the Liquidity Provider is the only AMM provider, false otherwise.
 
Expected< bool, TER > verifyAndAdjustLPTokenBalance(Sandbox &sb, STAmount const &lpTokens, std::shared_ptr< SLE > &ammSle, AccountID const &account)
Due to rounding, the LPTokenBalance of the last LP might not match the LP's trustline balance.
 
void initializeFeeAuctionVote(ApplyView &view, std::shared_ptr< SLE > &ammSle, AccountID const &account, Issue const &lptIssue, std::uint16_t tfee)
Initialize Auction and Voting slots and set the trading/discounted fee.
 
STAmount ammLPHolds(ReadView const &view, Currency const &cur1, Currency const &cur2, AccountID const &ammAccount, AccountID const &lpAccount, beast::Journal const j)
Get the balance of LP tokens.
 
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
 
std::pair< STAmount, STAmount > ammPoolHolds(ReadView const &view, AccountID const &ammAccountID, Issue const &issue1, Issue const &issue2, FreezeHandling freezeHandling, beast::Journal const j)
Get AMM pool balances.
 
Expected< std::tuple< STAmount, STAmount, STAmount >, TER > ammHolds(ReadView const &view, SLE const &ammSle, std::optional< Issue > const &optIssue1, std::optional< Issue > const &optIssue2, FreezeHandling freezeHandling, beast::Journal const j)
Get AMM pool and LP token balances.
 
STAmount ammAccountHolds(ReadView const &view, AccountID const &ammAccountID, Issue const &issue)
Returns total amount held by AMM for the given token.
 
TERSubset< CanCvtToTER > TER