Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alex v committed Nov 24, 2024
1 parent 274af2c commit 63fdd03
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/blsct/tokens/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class TokenEntry
public:
TokenInfo info;
CAmount nSupply;
std::map<CAmount, std::map<std::string, std::string>> mapMintedNft;
std::map<uint64_t, std::map<std::string, std::string>> mapMintedNft;

TokenEntry(){};
TokenEntry(const TokenInfo& info,
const CAmount& nSupply = 0) : info(info), nSupply(nSupply){};
TokenEntry(const TokenInfo& info,
const std::map<CAmount, std::map<std::string, std::string>>& mapMintedNft) : info(info), mapMintedNft(mapMintedNft){};
const std::map<uint64_t, std::map<std::string, std::string>>& mapMintedNft) : info(info), mapMintedNft(mapMintedNft){};

bool Mint(const CAmount& amount)
{
Expand Down
6 changes: 3 additions & 3 deletions src/blsct/tokens/predicate_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ struct MintTokenPredicate {

struct MintNftPredicate {
blsct::PublicKey publicKey;
CAmount nftId;
uint64_t nftId;
std::map<std::string, std::string> nftMetadata;

MintNftPredicate(){};
MintNftPredicate(const blsct::PublicKey& publicKey, const CAmount& nftId, const std::map<std::string, std::string>& nftMetadata) : publicKey(publicKey), nftId(nftId), nftMetadata(nftMetadata){};
MintNftPredicate(const blsct::PublicKey& publicKey, const uint64_t& nftId, const std::map<std::string, std::string>& nftMetadata) : publicKey(publicKey), nftId(nftId), nftMetadata(nftMetadata){};

SERIALIZE_METHODS(MintNftPredicate, obj)
{
Expand Down Expand Up @@ -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<MintNftPredicate>(predicate_).nftId;
Expand Down
4 changes: 2 additions & 2 deletions src/blsct/wallet/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, UniValue> metadata;
if (!request.params[3].isNull() && !request.params[3].get_obj().empty())
Expand Down Expand Up @@ -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<uint256, blsct::TokenEntry> tokens;
tokens[token_id];
Expand Down
2 changes: 1 addition & 1 deletion src/blsct/wallet/txfactory_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, std::string>& nftMetadata)
void TxFactoryBase::AddOutput(const Scalar& tokenKey, const SubAddress& destination, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map<std::string, std::string>& nftMetadata)
{
UnsignedOutput out;

Expand Down
4 changes: 2 additions & 2 deletions src/blsct/wallet/txfactory_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, std::string>& 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<std::string, std::string>& nftMetadata) : type(TX_MINT_TOKEN), tokenInfo(tokenInfo), destination(destination), token_id(TokenId(tokenInfo.publicKey.GetHash(), nftId)), nftMetadata(nftMetadata) {}
};

struct InputCandidates {
Expand Down Expand Up @@ -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<std::string, std::string>& nftMetadata);
void AddOutput(const Scalar& tokenKey, const SubAddress& destination, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map<std::string, std::string>& 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<CMutableTransaction> BuildTx(const blsct::DoublePublicKey& changeDestination, const CAmount& minStake = 0, const CreateTransactionType& type = NORMAL, const bool& fSubtractedFee = false);
static std::optional<CMutableTransaction> CreateTransaction(const std::vector<InputCandidates>& inputCandidates, const CreateTransactionData& transactionData);
Expand Down
2 changes: 1 addition & 1 deletion src/blsct/wallet/txfactory_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, std::string>& nftMetadata)
UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const Scalar& blindingKey, const Scalar& tokenKey, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map<std::string, std::string>& nftMetadata)
{
TokenId tokenId{tokenPublicKey.GetHash(), nftId};

Expand Down
2 changes: 1 addition & 1 deletion src/blsct/wallet/txfactory_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ AggregateTransactions(const std::vector<CTransactionRef>& 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<std::string, std::string>& nftMetadata);
UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destKeys, const Scalar& blindingKey, const Scalar& tokenKey, const blsct::PublicKey& tokenPublicKey, const uint64_t& nftId, const std::map<std::string, std::string>& 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);
Expand Down
3 changes: 0 additions & 3 deletions src/policy/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_dat
return false;
}

// if (whichType == TxoutType::NULL_DATA)
// nDataOut++;
//else
if ((whichType == TxoutType::MULTISIG) && (!permit_bare_multisig)) {
reason = "bare-multisig";
return false;
Expand Down

0 comments on commit 63fdd03

Please sign in to comment.