20 #include <ripple/app/tx/impl/DeleteAccount.h>
21 #include <ripple/app/tx/impl/DepositPreauth.h>
22 #include <ripple/app/tx/impl/SetSignerList.h>
23 #include <ripple/app/tx/impl/details/NFTokenUtils.h>
24 #include <ripple/basics/FeeUnits.h>
25 #include <ripple/basics/Log.h>
26 #include <ripple/basics/mulDiv.h>
27 #include <ripple/ledger/View.h>
28 #include <ripple/protocol/Feature.h>
29 #include <ripple/protocol/Indexes.h>
30 #include <ripple/protocol/Protocol.h>
31 #include <ripple/protocol/TxFlags.h>
32 #include <ripple/protocol/st.h>
64 using DeleterFuncPtr =
TER (*)(
98 removeTicketFromLedger(
110 removeDepositPreauthFromLedger(
122 removeNFTokenOfferFromLedger(
149 return removeTicketFromLedger;
151 return removeDepositPreauthFromLedger;
153 return removeNFTokenOfferFromLedger;
241 unsigned int uDirEntry{0};
247 ctx.
view, ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry))
260 <<
"DeleteAccount: directory node in ledger " << ctx.
view.
seq()
261 <<
" has index to object that is missing: "
269 if (!nonObligationDeleter(nodeType))
278 ctx.
view, ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry));
298 unsigned int uDirEntry{0};
301 if (
view().exists(ownerDirKeylet) &&
302 dirFirst(
view(), ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry))
312 <<
"DeleteAccount: Directory node in ledger "
313 <<
view().
seq() <<
" has index to object that is missing: "
321 if (
auto deleter = nonObligationDeleter(nodeType))
331 assert(!
"Undeletable entry should be found in preclaim.");
333 <<
"DeleteAccount undeletable item not found in preclaim.";
353 assert(uDirEntry == 1);
357 <<
"DeleteAccount iterator re-validation failed.";
363 view(), ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry));
375 if (
view().exists(ownerDirKeylet) && !
view().emptyDirDelete(ownerDirKeylet))
377 JLOG(
j_.
error()) <<
"DeleteAccount cannot delete root dir node of "
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
bool cdirNext(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the next entry in the directory, advancing the index.
const SF_UINT32 sfFirstNFTokenSequence
bool dirNext(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
@ ltTICKET
A ledger object which describes a ticket.
A pair of SHAMap key and LedgerEntryType.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
const SF_ACCOUNT sfDestination
const SF_UINT32 sfSequence
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
@ ltSIGNER_LIST
A ledger object which contains a signer list for an account.
const SF_UINT32 sfMintedNFTokens
const uint256 featureDepositAuth
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
static NotTEC preflight(PreflightContext const &ctx)
Keylet child(uint256 const &key) noexcept
Any item that can be in an owner dir.
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
static TER preclaim(PreclaimContext const &ctx)
static TER ticketDelete(ApplyView &view, AccountID const &account, uint256 const &ticketIndex, beast::Journal j)
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Writeable view to a ledger, for applying a transaction.
const uint256 fixNFTokenRemint
const uint256 featureDeletableAccounts
Integers of any length that is a multiple of 32-bits.
Keylet nftpage_min(AccountID const &owner)
NFT page keylets.
static TER removeFromLedger(Application &app, ApplyView &view, uint256 const &delIndex, beast::Journal j)
@ ltOFFER
A ledger object which describes an offer on the DEX.
constexpr std::size_t maxDeletableDirEntries
The maximum number of owner directory entries for account to be deletable.
Keylet account(AccountID const &id) noexcept
AccountID root.
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
@ ltNFTOKEN_OFFER
A ledger object which identifies an offer to buy or sell an NFT.
TERSubset< CanCvtToTER > TER
@ ltDEPOSIT_PREAUTH
A ledger object which describes a deposit preauthorization.
Keylet nftpage_max(AccountID const &owner)
A keylet for the owner's last possible NFT page.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
std::uint32_t getFlags() const
static TER removeFromLedger(Application &app, ApplyView &view, AccountID const &account, beast::Journal j)
void deliver(STAmount const &amount)
Sets the DeliveredAmount field in the metadata.
A generic endpoint for log messages.
virtual std::optional< key_type > succ(key_type const &key, std::optional< key_type > const &last=std::nullopt) const =0
Return the key of the next state item.
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.
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
@ ltNFTOKEN_PAGE
A ledger object which contains a list of NFTs.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
const uint256 featureNonFungibleTokensV1
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
const SF_UINT16 sfLedgerEntryType
LedgerEntryType
Identifiers for on-ledger objects.
LedgerIndex seq() const
Returns the sequence number of the base ledger.
virtual Rules const & rules() const =0
Returns the tx processing rules.
const SF_UINT32 sfDestinationTag
const SF_AMOUNT sfBalance
static TER removeSignersFromLedger(Application &app, ApplyView &view, Keylet const &accountKeylet, Keylet const &ownerDirKeylet, Keylet const &signerListKeylet, beast::Journal j)
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
const SF_ACCOUNT sfAccount
State information when preflighting a tx.
const SF_UINT32 sfBurnedNFTokens
bool cdirFirst(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the first entry in the directory, advancing the index.
constexpr std::uint32_t tfUniversalMask
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
bool deleteTokenOffer(ApplyView &view, std::shared_ptr< SLE > const &offer)
Deletes the given token offer.
TERSubset< CanCvtToNotTEC > NotTEC