From 63fdd03de2346f72571061970dbf3aebbd7dae93 Mon Sep 17 00:00:00 2001 From: alex v Date: Sun, 24 Nov 2024 21:57:34 +0100 Subject: [PATCH] more fixes --- src/blsct/tokens/info.h | 4 ++-- src/blsct/tokens/predicate_parser.h | 6 +++--- src/blsct/wallet/rpc.cpp | 4 ++-- src/blsct/wallet/txfactory_base.cpp | 2 +- src/blsct/wallet/txfactory_base.h | 4 ++-- src/blsct/wallet/txfactory_global.cpp | 2 +- src/blsct/wallet/txfactory_global.h | 2 +- src/policy/policy.cpp | 3 --- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/blsct/tokens/info.h b/src/blsct/tokens/info.h index b2b3d1ca3926d..03d47644c2f81 100644 --- a/src/blsct/tokens/info.h +++ b/src/blsct/tokens/info.h @@ -48,13 +48,13 @@ class TokenEntry public: TokenInfo info; CAmount nSupply; - std::map> mapMintedNft; + std::map> mapMintedNft; TokenEntry(){}; TokenEntry(const TokenInfo& info, const CAmount& nSupply = 0) : info(info), nSupply(nSupply){}; TokenEntry(const TokenInfo& info, - const std::map>& mapMintedNft) : info(info), mapMintedNft(mapMintedNft){}; + const std::map>& mapMintedNft) : info(info), mapMintedNft(mapMintedNft){}; bool Mint(const CAmount& amount) { diff --git a/src/blsct/tokens/predicate_parser.h b/src/blsct/tokens/predicate_parser.h index 345d755a1ae5a..11d7f61b9d468 100644 --- a/src/blsct/tokens/predicate_parser.h +++ b/src/blsct/tokens/predicate_parser.h @@ -63,11 +63,11 @@ struct MintTokenPredicate { struct MintNftPredicate { blsct::PublicKey publicKey; - CAmount nftId; + uint64_t nftId; std::map nftMetadata; MintNftPredicate(){}; - MintNftPredicate(const blsct::PublicKey& publicKey, const CAmount& nftId, const std::map& nftMetadata) : publicKey(publicKey), nftId(nftId), nftMetadata(nftMetadata){}; + MintNftPredicate(const blsct::PublicKey& publicKey, const uint64_t& nftId, const std::map& nftMetadata) : publicKey(publicKey), nftId(nftId), nftMetadata(nftMetadata){}; SERIALIZE_METHODS(MintNftPredicate, obj) { @@ -164,7 +164,7 @@ class ParsedPredicate throw std::ios_base::failure("wrong predicate type"); } - CAmount GetNftId() const + uint64_t GetNftId() const { if (IsMintNftPredicate()) return std::get(predicate_).nftId; diff --git a/src/blsct/wallet/rpc.cpp b/src/blsct/wallet/rpc.cpp index 7c1c0a196be79..cd30076709f14 100644 --- a/src/blsct/wallet/rpc.cpp +++ b/src/blsct/wallet/rpc.cpp @@ -299,7 +299,7 @@ static RPCHelpMan mintnft() auto blsct_km = pwallet->GetOrCreateBLSCTKeyMan(); uint256 token_id(ParseHashV(request.params[0], "token_id")); - CAmount nft_id = AmountFromValue(request.params[1], 0); + uint64_t nft_id = request.params[1].get_uint64(); const std::string address = request.params[2].get_str(); std::map metadata; if (!request.params[3].isNull() && !request.params[3].get_obj().empty()) @@ -649,7 +649,7 @@ RPCHelpMan sendnfttoblsctaddress() LOCK(pwallet->cs_wallet); uint256 token_id(ParseHashV(request.params[0], "token_id")); - CAmount nft_id(AmountFromValue(request.params[1], 0)); + uint64_t nft_id(request.params[1].get_uint64()); std::map tokens; tokens[token_id]; diff --git a/src/blsct/wallet/txfactory_base.cpp b/src/blsct/wallet/txfactory_base.cpp index 60c64af301902..1afbfc9fd53b2 100644 --- a/src/blsct/wallet/txfactory_base.cpp +++ b/src/blsct/wallet/txfactory_base.cpp @@ -70,7 +70,7 @@ void TxFactoryBase::AddOutput(const Scalar& tokenKey, const SubAddress& destinat // Mint NFT -void TxFactoryBase::AddOutput(const Scalar& tokenKey, const SubAddress& destination, const blsct::PublicKey& tokenPublicKey, const CAmount& nftId, const std::map& nftMetadata) +void TxFactoryBase::AddOutput(const Scalar& tokenKey, const SubAddress& destination, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map& nftMetadata) { UnsignedOutput out; diff --git a/src/blsct/wallet/txfactory_base.h b/src/blsct/wallet/txfactory_base.h index aa7b8645e752b..7ac1be7c6a16a 100644 --- a/src/blsct/wallet/txfactory_base.h +++ b/src/blsct/wallet/txfactory_base.h @@ -63,7 +63,7 @@ struct CreateTransactionData { CreateTransactionData(const blsct::TokenInfo& tokenInfo, const CAmount& mintAmount, const SubAddress& destination) : type(TX_MINT_TOKEN), tokenInfo(tokenInfo), destination(destination), nAmount(mintAmount), token_id(TokenId(tokenInfo.publicKey.GetHash())) {} - CreateTransactionData(const blsct::TokenInfo& tokenInfo, const CAmount& nftId, const SubAddress& destination, const std::map& nftMetadata) : type(TX_MINT_TOKEN), tokenInfo(tokenInfo), destination(destination), token_id(TokenId(tokenInfo.publicKey.GetHash(), nftId)), nftMetadata(nftMetadata) {} + CreateTransactionData(const blsct::TokenInfo& tokenInfo, const uint64_t& nftId, const SubAddress& destination, const std::map& nftMetadata) : type(TX_MINT_TOKEN), tokenInfo(tokenInfo), destination(destination), token_id(TokenId(tokenInfo.publicKey.GetHash(), nftId)), nftMetadata(nftMetadata) {} }; struct InputCandidates { @@ -96,7 +96,7 @@ class TxFactoryBase // Mint Token void AddOutput(const Scalar& tokenKey, const SubAddress& destination, const blsct::PublicKey& tokenPublicKey, const CAmount& mintAmount); // Mint NFT - void AddOutput(const Scalar& tokenKey, const SubAddress& destination, const blsct::PublicKey& tokenPublicKey, const CAmount& nftId, const std::map& nftMetadata); + void AddOutput(const Scalar& tokenKey, const SubAddress& destination, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map& nftMetadata); bool AddInput(const CAmount& amount, const MclScalar& gamma, const blsct::PrivateKey& spendingKey, const TokenId& token_id, const COutPoint& outpoint, const bool& stakedCommitment = false, const bool& rbf = false); std::optional BuildTx(const blsct::DoublePublicKey& changeDestination, const CAmount& minStake = 0, const CreateTransactionType& type = NORMAL, const bool& fSubtractedFee = false); static std::optional CreateTransaction(const std::vector& inputCandidates, const CreateTransactionData& transactionData); diff --git a/src/blsct/wallet/txfactory_global.cpp b/src/blsct/wallet/txfactory_global.cpp index 8a1cc4b6ab90e..5cb2720273700 100644 --- a/src/blsct/wallet/txfactory_global.cpp +++ b/src/blsct/wallet/txfactory_global.cpp @@ -67,7 +67,7 @@ UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const CAmoun return ret; } -UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const Scalar& blindingKey, const Scalar& tokenKey, const blsct::PublicKey& tokenPublicKey, const CAmount& nftId, const std::map& nftMetadata) +UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const Scalar& blindingKey, const Scalar& tokenKey, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map& nftMetadata) { TokenId tokenId{tokenPublicKey.GetHash(), nftId}; diff --git a/src/blsct/wallet/txfactory_global.h b/src/blsct/wallet/txfactory_global.h index 9eb9e099f8b45..c921ebcc556b6 100644 --- a/src/blsct/wallet/txfactory_global.h +++ b/src/blsct/wallet/txfactory_global.h @@ -79,7 +79,7 @@ AggregateTransactions(const std::vector& txs); UnsignedOutput CreateOutput(const Scalar& tokenKey, const blsct::TokenInfo& tokenInfo); UnsignedOutput CreateOutput(const Scalar& tokenKey, const blsct::TokenInfo& tokenInfo); UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const CAmount& nAmount, const Scalar& blindingKey, const Scalar& tokenKey, const blsct::PublicKey& tokenPublicKey); -UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const Scalar& blindingKey, const Scalar& tokenKey, const blsct::PublicKey& tokenPublicKey, const CAmount& nftId, const std::map& nftMetadata); +UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const Scalar& blindingKey, const Scalar& tokenKey, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map& nftMetadata); UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destination, const CAmount& nAmount, std::string sMemo, const TokenId& tokenId = TokenId(), const Scalar& blindingKey = Scalar::Rand(), const CreateTransactionType& type = NORMAL, const CAmount& minStake = 0); int32_t GetTransactionWeight(const CTransaction& tx); int32_t GetTransactioOutputWeight(const CTxOut& out); diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 24bec69135f78..e4338fc78cefc 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -138,9 +138,6 @@ bool IsStandardTx(const CTransaction& tx, const std::optional& max_dat return false; } - // if (whichType == TxoutType::NULL_DATA) - // nDataOut++; - //else if ((whichType == TxoutType::MULTISIG) && (!permit_bare_multisig)) { reason = "bare-multisig"; return false;