1#include <xrpl/tx/transactors/nft/NFTokenBurn.h>
3#include <xrpl/beast/utility/Journal.h>
4#include <xrpl/ledger/helpers/NFTokenHelpers.h>
5#include <xrpl/protocol/Indexes.h>
6#include <xrpl/protocol/Protocol.h>
7#include <xrpl/protocol/SField.h>
8#include <xrpl/protocol/STLedgerEntry.h>
9#include <xrpl/protocol/STTx.h>
10#include <xrpl/protocol/TER.h>
11#include <xrpl/protocol/XRPAmount.h>
12#include <xrpl/protocol/nft.h>
13#include <xrpl/tx/Transactor.h>
27 auto const owner = [&ctx]() {
31 return ctx.
tx[sfAccount];
39 if (
auto const account = ctx.
tx[sfAccount]; owner != account)
44 if (
auto const issuer =
nft::getIssuer(ctx.
tx[sfNFTokenID]); issuer != account)
48 if (
auto const minter = (*sle)[~sfNFTokenMinter]; minter != account)
63 ctx_.tx.isFieldPresent(sfOwner) ?
ctx_.tx.getAccountID(sfOwner)
64 :
ctx_.tx.getAccountID(sfAccount),
65 ctx_.tx[sfNFTokenID]);
73 (*issuer)[~sfBurnedNFTokens] = (*issuer)[~sfBurnedNFTokens].valueOr(0) + 1;
A generic endpoint for log messages.
virtual void update(SLE::ref sle)=0
Indicate changes to a peeked SLE.
bool finalizeInvariants(STTx const &tx, TER result, XRPAmount fee, ReadView const &view, beast::Journal const &j) override
Check transaction-specific post-conditions after all entries have been visited.
static TER preclaim(PreclaimContext const &ctx)
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
static NotTEC preflight(PreflightContext const &ctx)
virtual SLE::const_pointer read(Keylet const &k) const =0
Return the state item associated with a key.
std::shared_ptr< STLedgerEntry const > const & const_ref
bool isFieldPresent(SField const &field) const
AccountID getAccountID(SField const &field) const
Keylet nftSells(uint256 const &id) noexcept
The directory of sell offers for the specified NFT.
Keylet nftBuys(uint256 const &id) noexcept
The directory of buy offers for the specified NFT.
Keylet account(AccountID const &id) noexcept
AccountID root.
TER removeToken(ApplyView &view, AccountID const &owner, uint256 const &nftokenID)
Remove the token from the owner's token directory.
std::size_t removeTokenOffersWithLimit(ApplyView &view, Keylet const &directory, std::size_t maxDeletableOffers)
Delete up to a specified number of offers from the specified token offer directory.
std::optional< STObject > findToken(ReadView const &view, AccountID const &owner, uint256 const &nftokenID)
Finds the specified token in the owner's token directory.
AccountID getIssuer(uint256 const &id)
constexpr std::uint16_t const kFlagBurnable
std::uint16_t getFlags(uint256 const &id)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::size_t kMaxDeletableTokenOfferEntries
The maximum number of offers in an offer directory for NFT to be burnable.
TERSubset< CanCvtToNotTEC > NotTEC
bool isTesSuccess(TER x) noexcept
TERSubset< CanCvtToTER > TER
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.