<commit_before>// Copyright (c) 2009-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <core_io.h>

#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <key_io.h>
#include <script/script.h>
#include <script/standard.h>
#include <serialize.h>
#include <streams.h>
#include <univalue.h>
#include <util/system.h>
#include <util/strencodings.h>
// SYSCOIN
#include <services/asset.h>
bool AssetAllocationTxToJSON(const CTransaction &tx, const uint256& hashBlock, UniValue &entry) {
    const uint256& txHash = tx.GetHash();
    entry.__pushKV("txtype", stringFromSyscoinTx(tx.nVersion));
    entry.__pushKV("txid", txHash.GetHex());
    entry.__pushKV("blockhash", hashBlock.GetHex());  
    UniValue oAssetAllocationReceiversArray(UniValue::VARR);
   
    for(const auto &it: tx.voutAssets) {
        CAmount nTotal = 0;
        UniValue oAssetAllocationReceiversObj(UniValue::VOBJ);
        const uint32_t &nAsset = it.first;
        oAssetAllocationReceiversObj.__pushKV("asset_guid", nAsset);
        UniValue oAssetAllocationReceiverOutputsArray(UniValue::VARR);
        for(const auto& voutAsset: it.second){
            nTotal += voutAsset.nValue;
            UniValue oAssetAllocationReceiverOutputObj(UniValue::VOBJ);
            oAssetAllocationReceiverOutputObj.__pushKV("n", voutAsset.n);
            oAssetAllocationReceiverOutputObj.__pushKV("amount", voutAsset.nValue);
            oAssetAllocationReceiverOutputsArray.push_back(oAssetAllocationReceiverOutputObj);
        }
        oAssetAllocationReceiversObj.__pushKV("outputs", oAssetAllocationReceiverOutputsArray); 
        oAssetAllocationReceiversObj.__pushKV("total", nTotal);
        oAssetAllocationReceiversArray.push_back(oAssetAllocationReceiversObj);
    }

    entry.__pushKV("allocations", oAssetAllocationReceiversArray);
    if(tx.nVersion == SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_ETHEREUM){
         CBurnSyscoin burnSyscoin(tx);
         entry.__pushKV("ethereum_destination", "0x" + HexStr(burnSyscoin.vchEthAddress));
    }
    return true;
}


bool AssetMintTxToJson(const CTransaction& tx, const uint256& txHash, const uint256& hashBlock, UniValue &entry) {
    CMintSyscoin mintSyscoin(tx);
    if (!mintSyscoin.IsNull()) {
        entry.__pushKV("txtype", "assetallocationmint");
        entry.__pushKV("txid", txHash.GetHex());
        entry.__pushKV("blockhash", hashBlock.GetHex());  
        UniValue oAssetAllocationReceiversArray(UniValue::VARR);
        for(const auto &it: tx.voutAssets) {
            CAmount nTotal = 0;
            UniValue oAssetAllocationReceiversObj(UniValue::VOBJ);
            const uint32_t &nAsset = it.first;
            oAssetAllocationReceiversObj.__pushKV("asset_guid", nAsset);
            UniValue oAssetAllocationReceiverOutputsArray(UniValue::VARR);
            for(const auto& voutAsset: it.second){
                nTotal += voutAsset.nValue;
                UniValue oAssetAllocationReceiverOutputObj(UniValue::VOBJ);
                oAssetAllocationReceiverOutputObj.__pushKV("n", voutAsset.n);
                oAssetAllocationReceiverOutputObj.__pushKV("amount", voutAsset.nValue);
                oAssetAllocationReceiverOutputsArray.push_back(oAssetAllocationReceiverOutputObj);
            }
            oAssetAllocationReceiversObj.__pushKV("outputs", oAssetAllocationReceiverOutputsArray); 
            oAssetAllocationReceiversObj.__pushKV("total", nTotal);
            oAssetAllocationReceiversArray.push_back(oAssetAllocationReceiversObj);
        }
    
        entry.__pushKV("allocations", oAssetAllocationReceiversArray); 
        UniValue oSPVProofObj(UniValue::VOBJ);
        oSPVProofObj.__pushKV("bridgetransferid", mintSyscoin.nBridgeTransferID);   
        oSPVProofObj.__pushKV("txvalue", HexStr(mintSyscoin.vchTxValue));   
        oSPVProofObj.__pushKV("txparentnodes", HexStr(mintSyscoin.vchTxParentNodes)); 
        oSPVProofObj.__pushKV("txroot", HexStr(mintSyscoin.vchTxRoot));
        oSPVProofObj.__pushKV("txpath", HexStr(mintSyscoin.vchTxPath)); 
        oSPVProofObj.__pushKV("receiptvalue", HexStr(mintSyscoin.vchReceiptValue));   
        oSPVProofObj.__pushKV("receiptparentnodes", HexStr(mintSyscoin.vchReceiptParentNodes)); 
        oSPVProofObj.__pushKV("receiptroot", HexStr(mintSyscoin.vchReceiptRoot)); 
        oSPVProofObj.__pushKV("ethblocknumber", mintSyscoin.nBlockNumber); 
        entry.__pushKV("spv_proof", oSPVProofObj); 
        return true;
    } 
    return false;
}
bool AssetTxToJSON(const CTransaction& tx, const uint256 &hashBlock, UniValue &entry) {
	CAsset asset(tx);
	if(asset.IsNull())
		return false;
    const uint32_t &nAsset = asset.voutAssets.begin()->first;
    entry.__pushKV("txtype", stringFromSyscoinTx(tx.nVersion));
    entry.__pushKV("txid", tx.GetHash().GetHex());  
    entry.__pushKV("blockhash", hashBlock.GetHex());
    UniValue oAssetAllocationReceiversArray(UniValue::VARR);
    for(const auto &it: tx.voutAssets) {
        CAmount nTotal = 0;
        UniValue oAssetAllocationReceiversObj(UniValue::VOBJ);
        const uint32_t &nAsset = it.first;
        oAssetAllocationReceiversObj.__pushKV("asset_guid", nAsset);
        UniValue oAssetAllocationReceiverOutputsArray(UniValue::VARR);
        for(const auto& voutAsset: it.second){
            nTotal += voutAsset.nValue;
            UniValue oAssetAllocationReceiverOutputObj(UniValue::VOBJ);
            oAssetAllocationReceiverOutputObj.__pushKV("n", voutAsset.n);
            oAssetAllocationReceiverOutputObj.__pushKV("amount", voutAsset.nValue);
            oAssetAllocationReceiverOutputsArray.push_back(oAssetAllocationReceiverOutputObj);
        }
        oAssetAllocationReceiversObj.__pushKV("outputs", oAssetAllocationReceiverOutputsArray); 
        oAssetAllocationReceiversObj.__pushKV("total", nTotal);
        oAssetAllocationReceiversArray.push_back(oAssetAllocationReceiversObj);
    }

    entry.__pushKV("allocations", oAssetAllocationReceiversArray); 
    if (!asset.strSymbol.empty())
		entry.__pushKV("symbol", asset.strSymbol);<commit_msg>remove unused var<commit_after>// Copyright (c) 2009-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <core_io.h>

#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <key_io.h>
#include <script/script.h>
#include <script/standard.h>
#include <serialize.h>
#include <streams.h>
#include <univalue.h>
#include <util/system.h>
#include <util/strencodings.h>
// SYSCOIN
#include <services/asset.h>
bool AssetAllocationTxToJSON(const CTransaction &tx, const uint256& hashBlock, UniValue &entry) {
    const uint256& txHash = tx.GetHash();
    entry.__pushKV("txtype", stringFromSyscoinTx(tx.nVersion));
    entry.__pushKV("txid", txHash.GetHex());
    entry.__pushKV("blockhash", hashBlock.GetHex());  
    UniValue oAssetAllocationReceiversArray(UniValue::VARR);
   
    for(const auto &it: tx.voutAssets) {
        CAmount nTotal = 0;
        UniValue oAssetAllocationReceiversObj(UniValue::VOBJ);
        const uint32_t &nAsset = it.first;
        oAssetAllocationReceiversObj.__pushKV("asset_guid", nAsset);
        UniValue oAssetAllocationReceiverOutputsArray(UniValue::VARR);
        for(const auto& voutAsset: it.second){
            nTotal += voutAsset.nValue;
            UniValue oAssetAllocationReceiverOutputObj(UniValue::VOBJ);
            oAssetAllocationReceiverOutputObj.__pushKV("n", voutAsset.n);
            oAssetAllocationReceiverOutputObj.__pushKV("amount", voutAsset.nValue);
            oAssetAllocationReceiverOutputsArray.push_back(oAssetAllocationReceiverOutputObj);
        }
        oAssetAllocationReceiversObj.__pushKV("outputs", oAssetAllocationReceiverOutputsArray); 
        oAssetAllocationReceiversObj.__pushKV("total", nTotal);
        oAssetAllocationReceiversArray.push_back(oAssetAllocationReceiversObj);
    }

    entry.__pushKV("allocations", oAssetAllocationReceiversArray);
    if(tx.nVersion == SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_ETHEREUM){
         CBurnSyscoin burnSyscoin(tx);
         entry.__pushKV("ethereum_destination", "0x" + HexStr(burnSyscoin.vchEthAddress));
    }
    return true;
}


bool AssetMintTxToJson(const CTransaction& tx, const uint256& txHash, const uint256& hashBlock, UniValue &entry) {
    CMintSyscoin mintSyscoin(tx);
    if (!mintSyscoin.IsNull()) {
        entry.__pushKV("txtype", "assetallocationmint");
        entry.__pushKV("txid", txHash.GetHex());
        entry.__pushKV("blockhash", hashBlock.GetHex());  
        UniValue oAssetAllocationReceiversArray(UniValue::VARR);
        for(const auto &it: tx.voutAssets) {
            CAmount nTotal = 0;
            UniValue oAssetAllocationReceiversObj(UniValue::VOBJ);
            const uint32_t &nAsset = it.first;
            oAssetAllocationReceiversObj.__pushKV("asset_guid", nAsset);
            UniValue oAssetAllocationReceiverOutputsArray(UniValue::VARR);
            for(const auto& voutAsset: it.second){
                nTotal += voutAsset.nValue;
                UniValue oAssetAllocationReceiverOutputObj(UniValue::VOBJ);
                oAssetAllocationReceiverOutputObj.__pushKV("n", voutAsset.n);
                oAssetAllocationReceiverOutputObj.__pushKV("amount", voutAsset.nValue);
                oAssetAllocationReceiverOutputsArray.push_back(oAssetAllocationReceiverOutputObj);
            }
            oAssetAllocationReceiversObj.__pushKV("outputs", oAssetAllocationReceiverOutputsArray); 
            oAssetAllocationReceiversObj.__pushKV("total", nTotal);
            oAssetAllocationReceiversArray.push_back(oAssetAllocationReceiversObj);
        }
    
        entry.__pushKV("allocations", oAssetAllocationReceiversArray); 
        UniValue oSPVProofObj(UniValue::VOBJ);
        oSPVProofObj.__pushKV("bridgetransferid", mintSyscoin.nBridgeTransferID);   
        oSPVProofObj.__pushKV("txvalue", HexStr(mintSyscoin.vchTxValue));   
        oSPVProofObj.__pushKV("txparentnodes", HexStr(mintSyscoin.vchTxParentNodes)); 
        oSPVProofObj.__pushKV("txroot", HexStr(mintSyscoin.vchTxRoot));
        oSPVProofObj.__pushKV("txpath", HexStr(mintSyscoin.vchTxPath)); 
        oSPVProofObj.__pushKV("receiptvalue", HexStr(mintSyscoin.vchReceiptValue));   
        oSPVProofObj.__pushKV("receiptparentnodes", HexStr(mintSyscoin.vchReceiptParentNodes)); 
        oSPVProofObj.__pushKV("receiptroot", HexStr(mintSyscoin.vchReceiptRoot)); 
        oSPVProofObj.__pushKV("ethblocknumber", mintSyscoin.nBlockNumber); 
        entry.__pushKV("spv_proof", oSPVProofObj); 
        return true;
    } 
    return false;
}
bool AssetTxToJSON(const CTransaction& tx, const uint256 &hashBlock, UniValue &entry) {
	CAsset asset(tx);
	if(asset.IsNull())
		return false;
    entry.__pushKV("txtype", stringFromSyscoinTx(tx.nVersion));
    entry.__pushKV("txid", tx.GetHash().GetHex());  
    entry.__pushKV("blockhash", hashBlock.GetHex());
    UniValue oAssetAllocationReceiversArray(UniValue::VARR);
    for(const auto &it: tx.voutAssets) {
        CAmount nTotal = 0;
        UniValue oAssetAllocationReceiversObj(UniValue::VOBJ);
        const uint32_t &nAsset = it.first;
        oAssetAllocationReceiversObj.__pushKV("asset_guid", nAsset);
        UniValue oAssetAllocationReceiverOutputsArray(UniValue::VARR);
        for(const auto& voutAsset: it.second){
            nTotal += voutAsset.nValue;
            UniValue oAssetAllocationReceiverOutputObj(UniValue::VOBJ);
            oAssetAllocationReceiverOutputObj.__pushKV("n", voutAsset.n);
            oAssetAllocationReceiverOutputObj.__pushKV("amount", voutAsset.nValue);
            oAssetAllocationReceiverOutputsArray.push_back(oAssetAllocationReceiverOutputObj);
        }
        oAssetAllocationReceiversObj.__pushKV("outputs", oAssetAllocationReceiverOutputsArray); 
        oAssetAllocationReceiversObj.__pushKV("total", nTotal);
        oAssetAllocationReceiversArray.push_back(oAssetAllocationReceiversObj);
    }

    entry.__pushKV("allocations", oAssetAllocationReceiversArray); 
    if (!asset.strSymbol.empty())
		entry.__pushKV("symbol", asset.strSymbol);
{'fraction_non_alphanumeric': 0.10673701298701299, 'fraction_numerical': 0.00551948051948052, 'mean_word_length': 4.059958932238193, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1025084', 'n_tokens_mistral': 4092, 'n_tokens_neox': 3910, 'n_words': 531}