1#include <xrpl/ledger/ReadView.h>
2#include <xrpl/protocol/AmountConversions.h>
3#include <xrpl/protocol/Indexes.h>
4#include <xrpl/protocol/STAmount.h>
21 result = sleRippleState->getFieldAmount(
22 account < issuer ? sfLowLimit : sfHighLimit);
23 result.setIssuer(account);
27 result.getIssuer() == account,
28 "ripple::creditLimit : result issuer match");
30 result.getCurrency() == currency,
31 "ripple::creditLimit : result currency match");
58 result = sleRippleState->getFieldAmount(sfBalance);
61 result.setIssuer(account);
65 result.getIssuer() == account,
66 "ripple::creditBalance : result issuer match");
68 result.getCurrency() == currency,
69 "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)