diff --git a/src/omnicore/tx.cpp b/src/omnicore/tx.cpp index deb01cce484e2..04589e1d2bcfb 100644 --- a/src/omnicore/tx.cpp +++ b/src/omnicore/tx.cpp @@ -1491,16 +1491,33 @@ int CMPTransaction::logicMath_SendAll() continue; } - if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { - // do not transfer non-fungible tokens - if (isPropertyNonFungible(propertyId)) { - PrintToConsole("%s: property %d is non-fungible and will not be included in processing.\n", __func__, propertyId); - continue; - } - } - int64_t moneyAvailable = ptally->getMoney(propertyId, BALANCE); + int64_t moneyNft = 0; + if (moneyAvailable > 0) { + if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { + if (isPropertyNonFungible(propertyId)) { + std::vector > > rangeMap = pDbNFT->GetNonFungibleTokenRanges(propertyId); + + for (std::vector > >::iterator it = rangeMap.begin(); it!= rangeMap.end(); ++it) { + const std::pair >& entry = *it; + const std::string& address = entry.first; + const std::pair& range = entry.second; + + if (address != sender) { + continue; + } + + bool success = pDbNFT->MoveNonFungibleTokens(propertyId, range.first, range.second, sender, receiver); + int64_t amount = (range.second - range.first) + 1; + moneyNft += amount; + + PrintToLog("%s: moving %d nfts of property %d from %s to %s. success? %d\n", __func__, amount, propertyId, sender, receiver, success); + } + PrintToLog("%s: total %d nfts moved of %d expected\n", __func__, moneyNft, moneyAvailable); + } + } + ++numberOfPropertiesSent; assert(update_tally_map(sender, propertyId, -moneyAvailable, BALANCE)); assert(update_tally_map(receiver, propertyId, moneyAvailable, BALANCE));