Browse Source

ETH NFT fix

pull/453/head
miketout 2 years ago
parent
commit
25d2bbe259
  1. 1
      src/key_io.cpp
  2. 2
      src/pbaas/identity.cpp
  3. 31
      src/pbaas/pbaas.cpp

1
src/key_io.cpp

@ -1233,6 +1233,7 @@ CScript CIdentity::IdentityUpdateOutputScript(uint32_t height, const std::vector
if (IsRevoked())
{
// TODO: HARDENING for next testnet reset and mainnet release version, remove primary when revoked
ret = MakeMofNCCScript(1, primary, recovery, indexDests);
}
else

2
src/pbaas/identity.cpp

@ -2154,7 +2154,7 @@ bool PrecheckIdentityPrimary(const CTransaction &tx, int32_t outNum, CValidation
// consider the signature unfulfilled
if ((PBAAS_TESTMODE && (!(IsVerusActive() || ConnectedChains.ThisChain().name == "Gravity") || height >= TESTNET_FORK_HEIGHT)) && identity.HasTokenizedControl())
{
if (!(oneP.m == 1 && oneP.n > 1))
if (!(oneP.m == 1 && oneP.n >= oneP.m))
{
std::string errorOut = "Invalid spend condition for tokenized control in: \"" + identity.name + "\"";
return state.Error(errorOut.c_str());

31
src/pbaas/pbaas.cpp

@ -1900,27 +1900,24 @@ bool PrecheckCurrencyDefinition(const CTransaction &spendingTx, int32_t outNum,
newCurrency.OPTION_GATEWAY_CONVERTER) &&
newCurrency.IsToken();
if (newCurrency.nativeCurrencyID.TypeNoFlags() == newCurrency.nativeCurrencyID.DEST_ETHNFT &&
!(isNFTMappedCurrency &&
if (!(newCurrency.nativeCurrencyID.TypeNoFlags() == newCurrency.nativeCurrencyID.DEST_ETHNFT &&
isNFTMappedCurrency &&
systemDef.proofProtocol == systemDef.PROOF_ETHNOTARIZATION &&
systemDef.IsGateway() &&
newCurrency.maxPreconvert.size() == 1 &&
newCurrency.maxPreconvert[0] == 0 &&
newCurrency.GetTotalPreallocation() == 0))
{
return state.Error("NFT mapped currency must have only 0 satoshi of supply and follow all definition rules");
}
else if (newCurrency.IsNFTToken() &&
!(isNFTMappedCurrency &&
newCurrency.systemID == ASSETCHAINS_CHAINID &&
((newCurrency.GetTotalPreallocation() == 0 &&
newCurrency.maxPreconvert.size() == 1 &&
newCurrency.maxPreconvert[0] == 1) ||
(newCurrency.GetTotalPreallocation() == 1 &&
newCurrency.maxPreconvert.size() == 1 &&
newCurrency.maxPreconvert[0] == 0))))
{
return state.Error("Tokenized ID currency must have only 1 satoshi of supply as preallocation or convertible and follow all definition rules");
newCurrency.GetTotalPreallocation() == 0) &&
!(newCurrency.IsNFTToken() &&
isNFTMappedCurrency &&
newCurrency.systemID == ASSETCHAINS_CHAINID &&
((newCurrency.GetTotalPreallocation() == 0 &&
newCurrency.maxPreconvert.size() == 1 &&
newCurrency.maxPreconvert[0] == 1) ||
(newCurrency.GetTotalPreallocation() == 1 &&
newCurrency.maxPreconvert.size() == 1 &&
newCurrency.maxPreconvert[0] == 0))))
{
return state.Error("NFT mapped currency must have only " + std::string(newCurrency.nativeCurrencyID.TypeNoFlags() == newCurrency.nativeCurrencyID.DEST_ETHNFT ? "0" : "1") + " satoshi of supply and follow all definition rules");
}
// TODO: HARDENING - add hardening to ensure that no more than one satoshi at a time ever comes in from a bridge for an NFT mapped currency

Loading…
Cancel
Save