1#include <xrpl/ledger/ReadView.h>
2#include <xrpl/protocol/AmountConversions.h>
3#include <xrpl/protocol/Indexes.h>
4#include <xrpl/protocol/STAmount.h>
17 result = sleRippleState->getFieldAmount(account < issuer ? sfLowLimit : sfHighLimit);
18 result.setIssuer(account);
21 XRPL_ASSERT(result.getIssuer() == account,
"xrpl::creditLimit : result issuer match");
22 XRPL_ASSERT(result.getCurrency() == currency,
"xrpl::creditLimit : result currency match");
41 result = sleRippleState->getFieldAmount(sfBalance);
44 result.setIssuer(account);
47 XRPL_ASSERT(result.getIssuer() == account,
"xrpl::creditBalance : result issuer match");
48 XRPL_ASSERT(result.getCurrency() == currency,
"xrpl::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 creditLimit2(ReadView const &v, AccountID const &acc, AccountID const &iss, Currency const &cur)
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 toAmount< IOUAmount >(STAmount const &amt)