20 #include <ripple/app/tx/impl/Clawback.h>
21 #include <ripple/ledger/View.h>
22 #include <ripple/protocol/Feature.h>
23 #include <ripple/protocol/Indexes.h>
24 #include <ripple/protocol/Protocol.h>
25 #include <ripple/protocol/TxFlags.h>
26 #include <ripple/protocol/st.h>
48 if (issuer == holder ||
isXRP(clawAmount) || clawAmount <= beast::zero)
63 if (!sleIssuer || !sleHolder)
66 if (sleHolder->isFieldPresent(
sfAMMID))
77 auto const sleRippleState =
85 if (balance > beast::zero && issuer < holder)
89 if (balance < beast::zero && issuer > holder)
107 ctx.
j) <= beast::zero)
122 if (holder == issuer)
138 std::min(spendableAmount, clawAmount),
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
const uint256 featureClawback
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
constexpr const std::uint32_t tfClawbackMask
void setIssuer(AccountID const &uIssuer)
@ lsfAllowTrustLineClawback
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
AccountID const & getIssuer() const
static TER preclaim(PreclaimContext const &ctx)
Keylet account(AccountID const &id) noexcept
AccountID root.
std::uint32_t getFlags() const
bool isXRP(AccountID const &c)
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
State information when determining if a tx is likely to claim a fee.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
const SF_AMOUNT sfBalance
const SF_ACCOUNT sfAccount
State information when preflighting a tx.
Currency const & getCurrency() const
static NotTEC preflight(PreflightContext const &ctx)
TERSubset< CanCvtToNotTEC > NotTEC