From a28a2435f4b046fe97ed9120ef67d191b1a64d81 Mon Sep 17 00:00:00 2001 From: baoLuck Date: Tue, 14 Apr 2026 22:36:56 +0300 Subject: [PATCH 1/2] qswap create pool fix --- argparser.h | 7 ++++--- main.cpp | 2 +- qswap.cpp | 13 ++++++++++++- qswap.h | 1 + qswap_struct.h | 1 + 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/argparser.h b/argparser.h index b39ec668..b61da063 100644 --- a/argparser.h +++ b/argparser.h @@ -390,7 +390,7 @@ void print_help() printf("\t\tTransfer an asset via Qswap contract.\n"); printf("\t-qswaptransferassetrights \n"); printf("\t\tTransfer an asset rights.\n"); - printf("\t-qswapcreatepool \n"); + printf("\t-qswapcreatepool \n"); printf("\t\tCreate an AMM pool via Qswap contract.\n"); printf("\t-qswapgetpoolbasicstate \n"); printf("\t\tGet the basic information of a pool.\n"); @@ -1278,10 +1278,11 @@ void parseArgument(int argc, char** argv) } if (strcmp(argv[i], "-qswapcreatepool") == 0) { - CHECK_NUMBER_OF_PARAMETERS(1) + CHECK_NUMBER_OF_PARAMETERS(2) g_cmd = QSWAP_CREATE_POOL; g_qswap_assetName = argv[i+1]; - i+=2; + g_qswap_issuer = argv[i+2]; + i+=3; CHECK_OVER_PARAMETERS break; } diff --git a/main.cpp b/main.cpp index 2e17372f..fc7a5846 100644 --- a/main.cpp +++ b/main.cpp @@ -852,7 +852,7 @@ int run(int argc, char* argv[]) sanityCheckValidAssetName(g_qswap_assetName); sanityCheckValidString(g_qswap_issuer); qswapCreatePool(g_nodeIp, g_nodePort, g_seed, - g_qswap_assetName, + g_qswap_assetName, g_qswap_issuer, g_offsetScheduledTick); break; case QSWAP_ADD_LIQUIDITY: diff --git a/qswap.cpp b/qswap.cpp index 9bc4913d..6f79fd51 100644 --- a/qswap.cpp +++ b/qswap.cpp @@ -253,6 +253,7 @@ void qswapTransferAssetRights(const char* nodeIp, int nodePort, void qswapCreatePool(const char* nodeIp, int nodePort, const char* seed, const char* pAssetName, + const char* pIssuerInQubicFormat, uint32_t scheduledTickOffset) { auto qc = make_qc(nodeIp, nodePort); @@ -262,11 +263,19 @@ void qswapCreatePool(const char* nodeIp, int nodePort, uint8_t subSeed[32] = {0}; uint8_t digest[32] = {0}; uint8_t signature[64] = {0}; + uint8_t issuer[32] = {0}; char txHash[128] = {0}; char assetNameS1[8] = {0}; memcpy(assetNameS1, pAssetName, strlen(pAssetName)); + if (strlen(pIssuerInQubicFormat) != 60) + { + LOG("WARNING: Stop supporting hex format, please use qubic format 60-char length addresses\n"); + exit(0); + } + getPublicKeyFromIdentity(pIssuerInQubicFormat, issuer); + getSubseedFromSeed((uint8_t*)seed, subSeed); getPrivateKeyFromSubSeed(subSeed, privateKey); getPublicKeyFromPrivateKey(privateKey, sourcePublicKey); @@ -289,11 +298,13 @@ void qswapCreatePool(const char* nodeIp, int nodePort, // DEBUG LOG LOG("\n-------------------------------------\n\n"); - LOG("Sending QSWAP - CreatePool\n"); + LOG("Sending QSWAP - CreatePool\n");\ + LOG("Issuer: %s\n", pIssuerInQubicFormat); LOG("assetName: %s\n", assetNameS1); LOG("\n-------------------------------------\n\n"); // fill the input + memcpy(packet.cp.issuer, issuer, 32); memcpy(&packet.cp.assetName, assetNameS1, 8); // sign the packet diff --git a/qswap.h b/qswap.h index 1d04052d..59c3a43a 100644 --- a/qswap.h +++ b/qswap.h @@ -29,6 +29,7 @@ void printQswapFee(const char* nodeIp, const int nodePort); void qswapCreatePool(const char* nodeIp, int nodePort, const char* seed, const char* pAssetName, + const char* pIssuerInQubicFormat, uint32_t scheduledTickOffset); void qswapAddLiquidity(const char* nodeIp, int nodePort, diff --git a/qswap_struct.h b/qswap_struct.h index 4b1c12c7..3c4d7625 100644 --- a/qswap_struct.h +++ b/qswap_struct.h @@ -57,6 +57,7 @@ struct SwapAssetForQuAction_input }; struct CreatePool_input { + uint8_t issuer[32]; uint64_t assetName; }; From 1eb4aff316f3393ebfd1b1e21653b2bc239ec9dc Mon Sep 17 00:00:00 2001 From: baoLuck Date: Tue, 14 Apr 2026 22:39:15 +0300 Subject: [PATCH 2/2] typo --- qswap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qswap.cpp b/qswap.cpp index 6f79fd51..731ad252 100644 --- a/qswap.cpp +++ b/qswap.cpp @@ -298,7 +298,7 @@ void qswapCreatePool(const char* nodeIp, int nodePort, // DEBUG LOG LOG("\n-------------------------------------\n\n"); - LOG("Sending QSWAP - CreatePool\n");\ + LOG("Sending QSWAP - CreatePool\n"); LOG("Issuer: %s\n", pIssuerInQubicFormat); LOG("assetName: %s\n", assetNameS1); LOG("\n-------------------------------------\n\n");