mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Introduce NFT support (XLS020)
This commit is contained in:
committed by
manojsdoshi
parent
525aaecbca
commit
70779f6850
@@ -58,8 +58,7 @@ SetAccount::makeTxConsequences(PreflightContext const& ctx)
|
||||
NotTEC
|
||||
SetAccount::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
auto const ret = preflight1(ctx);
|
||||
if (!isTesSuccess(ret))
|
||||
if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
|
||||
return ret;
|
||||
|
||||
auto& tx = ctx.tx;
|
||||
@@ -100,7 +99,7 @@ SetAccount::preflight(PreflightContext const& ctx)
|
||||
// RequireDestTag
|
||||
//
|
||||
bool bSetRequireDest =
|
||||
(uTxFlags & TxFlag::requireDestTag) || (uSetFlag == asfRequireDest);
|
||||
(uTxFlags & tfRequireDestTag) || (uSetFlag == asfRequireDest);
|
||||
bool bClearRequireDest =
|
||||
(uTxFlags & tfOptionalDestTag) || (uClearFlag == asfRequireDest);
|
||||
|
||||
@@ -166,13 +165,25 @@ SetAccount::preflight(PreflightContext const& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
auto const domain = tx[~sfDomain];
|
||||
if (domain && domain->size() > DOMAIN_BYTES_MAX)
|
||||
if (auto const domain = tx[~sfDomain];
|
||||
domain && domain->size() > maxDomainLength)
|
||||
{
|
||||
JLOG(j.trace()) << "domain too long";
|
||||
return telBAD_DOMAIN;
|
||||
}
|
||||
|
||||
if (ctx.rules.enabled(featureNonFungibleTokensV1))
|
||||
{
|
||||
// Configure authorized minting account:
|
||||
if (uSetFlag == asfAuthorizedNFTokenMinter &&
|
||||
!tx.isFieldPresent(sfNFTokenMinter))
|
||||
return temMALFORMED;
|
||||
|
||||
if (uClearFlag == asfAuthorizedNFTokenMinter &&
|
||||
tx.isFieldPresent(sfNFTokenMinter))
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
return preflight2(ctx);
|
||||
}
|
||||
|
||||
@@ -227,7 +238,7 @@ SetAccount::doApply()
|
||||
// legacy AccountSet flags
|
||||
std::uint32_t const uTxFlags{tx.getFlags()};
|
||||
bool const bSetRequireDest{
|
||||
(uTxFlags & TxFlag::requireDestTag) || (uSetFlag == asfRequireDest)};
|
||||
(uTxFlags & tfRequireDestTag) || (uSetFlag == asfRequireDest)};
|
||||
bool const bClearRequireDest{
|
||||
(uTxFlags & tfOptionalDestTag) || (uClearFlag == asfRequireDest)};
|
||||
bool const bSetRequireAuth{
|
||||
@@ -516,6 +527,17 @@ SetAccount::doApply()
|
||||
}
|
||||
}
|
||||
|
||||
// Configure authorized minting account:
|
||||
if (ctx_.view().rules().enabled(featureNonFungibleTokensV1))
|
||||
{
|
||||
if (uSetFlag == asfAuthorizedNFTokenMinter)
|
||||
sle->setAccountID(sfNFTokenMinter, ctx_.tx[sfNFTokenMinter]);
|
||||
|
||||
if (uClearFlag == asfAuthorizedNFTokenMinter &&
|
||||
sle->isFieldPresent(sfNFTokenMinter))
|
||||
sle->makeFieldAbsent(sfNFTokenMinter);
|
||||
}
|
||||
|
||||
if (uFlagsIn != uFlagsOut)
|
||||
sle->setFieldU32(sfFlags, uFlagsOut);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user