1#include <xrpld/app/tx/detail/LoanBrokerCoverDeposit.h>
3#include <xrpld/app/misc/LendingHelpers.h>
16 if (ctx.
tx[sfLoanBrokerID] == beast::zero)
19 auto const dstAmount = ctx.
tx[sfAmount];
20 if (dstAmount <= beast::zero)
32 auto const& tx = ctx.
tx;
34 auto const account = tx[sfAccount];
35 auto const brokerID = tx[sfLoanBrokerID];
36 auto const amount = tx[sfAmount];
41 JLOG(ctx.
j.
warn()) <<
"LoanBroker does not exist.";
44 if (account != sleBroker->at(sfOwner))
46 JLOG(ctx.
j.
warn()) <<
"Account is not the owner of the LoanBroker.";
53 JLOG(ctx.
j.
fatal()) <<
"Vault is missing for Broker " << brokerID;
58 auto const vaultAsset = vault->at(sfAsset);
59 if (amount.asset() != vaultAsset)
62 auto const pseudoAccountID = sleBroker->at(sfAccount);
95 auto const brokerID = tx[sfLoanBrokerID];
96 auto const amount = tx[sfAmount];
102 auto const brokerPseudoID = broker->at(sfAccount);
115 broker->at(sfCoverAvailable) += amount;
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
static bool checkExtraFeatures(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
Keylet loanbroker(AccountID const &owner, std::uint32_t seq) noexcept
Keylet vault(AccountID const &owner, std::uint32_t seq) noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
TER checkDeepFrozen(ReadView const &view, AccountID const &account, Issue const &issue)
TER checkFrozen(ReadView const &view, AccountID const &account, Issue const &issue)
bool isLegalNet(STAmount const &value)
bool checkLendingProtocolDependencies(PreflightContext const &ctx)
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.