Skip to content

Commit

Permalink
Fix rawissueasset
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixa84 committed Jul 18, 2024
1 parent 783abfc commit 0b99200
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/issuance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void AppendInitialIssuance(CBlock& genesis_block, const COutPoint& prevout, cons
txNew.vin[0].assetIssuance.assetEntropy = contract;
txNew.vin[0].assetIssuance.nAmount = CConfidentialValue(asset_values * asset_outputs);
txNew.vin[0].assetIssuance.nInflationKeys = CConfidentialValue(reissuance_values * reissuance_outputs);
txNew.vin[0].assetIssuance.denomination = 8;
txNew.vin[0].assetIssuance.nDenomination = 8;

for (unsigned int i = 0; i < asset_outputs; i++) {
txNew.vout.push_back(CTxOut(asset, CConfidentialValue(asset_values), issuance_destination));
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/confidential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ std::string CAssetIssuance::ToString() const
str += strprintf(", amount=%s", (nAmount.IsExplicit() ? strprintf("%d.%08d", nAmount.GetAmount() / COIN, nAmount.GetAmount() % COIN) : std::string("CONFIDENTIAL")));
if (!nInflationKeys.IsNull())
str += strprintf(", inflationkeys=%s", (nInflationKeys.IsExplicit() ? strprintf("%d.%08d", nInflationKeys.GetAmount() / COIN, nInflationKeys.GetAmount() % COIN) : std::string("CONFIDENTIAL")));
str += strprintf("%d", denomination);
str += strprintf("%d", nDenomination);
str += ")";
return str;
}
6 changes: 3 additions & 3 deletions src/primitives/confidential.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ class CAssetIssuance
// generating transaction.
CConfidentialValue nInflationKeys;

uint8_t denomination = 8;
uint8_t nDenomination = 8;

public:
CAssetIssuance()
{
SetNull();
}

SERIALIZE_METHODS(CAssetIssuance, obj) { READWRITE(obj.assetBlindingNonce, obj.assetEntropy, obj.nAmount, obj.nInflationKeys, obj.denomination); }
SERIALIZE_METHODS(CAssetIssuance, obj) { READWRITE(obj.assetBlindingNonce, obj.assetEntropy, obj.nAmount, obj.nInflationKeys, obj.nDenomination); }

void SetNull() { nAmount.SetNull(); nInflationKeys.SetNull(); }
bool IsNull() const { return (nAmount.IsNull() && nInflationKeys.IsNull()); }
Expand All @@ -211,7 +211,7 @@ class CAssetIssuance
a.assetEntropy == b.assetEntropy &&
a.nAmount == b.nAmount &&
a.nInflationKeys == b.nInflationKeys;
a.denomination == b.denomination;
a.nDenomination == b.nDenomination;
}

friend bool operator!=(const CAssetIssuance& a, const CAssetIssuance& b)
Expand Down
1 change: 1 addition & 0 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2928,6 +2928,7 @@ void issueasset_base(CMutableTransaction& mtx, RawIssuanceDetails& issuance_deta
issuance_details.denomination = denomination;

mtx.vin[issuance_input_index].assetIssuance.assetEntropy = contract_hash;
mtx.vin[issuance_input_index].assetIssuance.nDenomination = issuance_details.denomination;

if (asset_amount > 0) {
// Fee output is required to be last. We will insert _before_ the selected position, which preserves that.
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpc/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ RPCHelpMan listissuances()
}
CAmount iaamount = pcoin->GetIssuanceAmount(*pwallet, vinIndex, false);
item.pushKV("assetamount", (iaamount == -1 ) ? -1 : ValueFromAmount(iaamount));
item.pushKV("denomination", issuance.denomination);
item.pushKV("denomination", issuance.nDenomination);
item.pushKV("assetblinds", pcoin->GetIssuanceBlindingFactor(*pwallet, vinIndex, false).GetHex());
if (!asset_filter.IsNull() && asset_filter != asset) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/spend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ static bool CreateTransactionInternal(
}
}
// SEQUENTIA: Add denomination in the asset issuance
txNew.vin[0].assetIssuance.denomination = issuance_details->denomination;
txNew.vin[0].assetIssuance.nDenomination = issuance_details->denomination;
// Asset being reissued with explicitly named asset/token
} else if (asset_index != -1) {
assert(reissuance_index != -1);
Expand Down

0 comments on commit 0b99200

Please sign in to comment.