20#include <xrpl/ledger/ReadView.h>
21#include <xrpl/protocol/AmountConversions.h>
22#include <xrpl/protocol/Indexes.h>
23#include <xrpl/protocol/STAmount.h>
40 result = sleRippleState->getFieldAmount(
41 account < issuer ? sfLowLimit : sfHighLimit);
42 result.setIssuer(account);
46 result.getIssuer() == account,
47 "ripple::creditLimit : result issuer match");
49 result.getCurrency() == currency,
50 "ripple::creditLimit : result currency match");
77 result = sleRippleState->getFieldAmount(sfBalance);
80 result.setIssuer(account);
84 result.getIssuer() == account,
85 "ripple::creditBalance : result issuer match");
87 result.getCurrency() == currency,
88 "ripple::creditBalance : result currency match");
A currency issued by an account.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
STAmount creditLimit(ReadView const &view, AccountID const &account, AccountID const &issuer, Currency const ¤cy)
Calculate the maximum amount of IOUs that an account can hold.
IOUAmount toAmount< IOUAmount >(STAmount const &amt)
STAmount creditBalance(ReadView const &view, AccountID const &account, AccountID const &issuer, Currency const ¤cy)
Returns the amount of IOUs issued by issuer that are held by an account.
IOUAmount creditLimit2(ReadView const &v, AccountID const &acc, AccountID const &iss, Currency const &cur)