mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
add URIToken deleter for account delete, change blank uri to tfBurn flag for burning
This commit is contained in:
@@ -142,6 +142,38 @@ removeNFTokenOfferFromLedger(
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
/** Remove a generic object that only lives in the owner's directory */
|
||||
TER
|
||||
removeGeneric(
|
||||
Application& app,
|
||||
ApplyView& view,
|
||||
AccountID const& account,
|
||||
uint256 const& delIndex,
|
||||
std::shared_ptr<SLE> const& sleDel,
|
||||
beast::Journal)
|
||||
{
|
||||
if (!sleDel)
|
||||
return tesSUCCESS;
|
||||
|
||||
auto const owner = (*offer)[sfOwner];
|
||||
|
||||
if (!view.dirRemove(
|
||||
keylet::ownerDir(account),
|
||||
(*sleDel)[sfOwnerNode],
|
||||
sleDel->key(),
|
||||
false))
|
||||
return false;
|
||||
|
||||
adjustOwnerCount(
|
||||
view,
|
||||
view.peek(keylet::account(account)),
|
||||
-1,
|
||||
beast::Journal{beast::Journal::getNullSink()});
|
||||
|
||||
view.erase(sleDel);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return nullptr if the LedgerEntryType represents an obligation that can't
|
||||
// be deleted. Otherwise return the pointer to the function that can delete
|
||||
// the non-obligation
|
||||
@@ -160,6 +192,8 @@ nonObligationDeleter(LedgerEntryType t)
|
||||
return removeDepositPreauthFromLedger;
|
||||
case ltNFTOKEN_OFFER:
|
||||
return removeNFTokenOfferFromLedger;
|
||||
case ltURI_TOKEN:
|
||||
return removeGeneric;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -43,24 +43,24 @@ inline URIOperation inferOperation(STTx const& tx)
|
||||
uint32_t const flags = tx.getFlags();
|
||||
bool const hasDigest = tx.isFieldPresent(sfDigest);
|
||||
bool const hasURI = tx.isFieldPresent(sfURI);
|
||||
bool const blankURI = hasURI && tx.getFieldVL(sfURI).empty();
|
||||
bool const hasBurnFlag = flags == tfBurn;
|
||||
bool const hasID = tx.isFieldPresent(sfURITokenID);
|
||||
bool const hasAmt = tx.isFieldPresent(sfAmount);
|
||||
bool const hasDst = tx.isFieldPresent(sfDestination);
|
||||
bool const hasSellFlag = flags == tfSell;
|
||||
bool const hasBurnFlag = flags == tfBurnable;
|
||||
bool const hasBurnableFlag = flags == tfBurnable;
|
||||
bool const blankFlags = flags == 0;
|
||||
|
||||
uint16_t combination =
|
||||
(hasDigest ? 0b100000000U : 0) +
|
||||
(hasURI ? 0b010000000U : 0) +
|
||||
(blankURI ? 0b001000000U : 0) +
|
||||
(hasID ? 0b000100000U : 0) +
|
||||
(hasAmt ? 0b000010000U : 0) +
|
||||
(hasDst ? 0b000001000U : 0) +
|
||||
(hasSellFlag ? 0b000000100U : 0) +
|
||||
(hasBurnFlag ? 0b000000010U : 0) +
|
||||
(blankFlags ? 0b000000001U : 0);
|
||||
(hasDigest ? 0b100000000U : 0) +
|
||||
(hasURI ? 0b010000000U : 0) +
|
||||
(hasBurnFlag ? 0b001000000U : 0) +
|
||||
(hasID ? 0b000100000U : 0) +
|
||||
(hasAmt ? 0b000010000U : 0) +
|
||||
(hasDst ? 0b000001000U : 0) +
|
||||
(hasSellFlag ? 0b000000100U : 0) +
|
||||
(hasBurnableFlag ? 0b000000010U : 0) +
|
||||
(blankFlags ? 0b000000001U : 0);
|
||||
|
||||
switch (combination)
|
||||
{
|
||||
|
||||
@@ -129,6 +129,9 @@ constexpr std::uint32_t const tfStrongTSH = 0x00008000;
|
||||
constexpr std::uint32_t const tfNFTokenMintOldMask =
|
||||
~(tfUniversal | tfBurnable | tfOnlyXRP | tfTrustLine | tfTransferable | tfStrongTSH);
|
||||
|
||||
// URIToken flags:
|
||||
constexpr std::uint32_t const tfBurn = 0x00000002;
|
||||
|
||||
// Prior to fixRemoveNFTokenAutoTrustLine, transfer of an NFToken between
|
||||
// accounts allowed a TrustLine to be added to the issuer of that token
|
||||
// without explicit permission from that issuer. This was enabled by
|
||||
|
||||
Reference in New Issue
Block a user