Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SET(FILES ${CMAKE_SOURCE_DIR}/asset_utils.cpp
${CMAKE_SOURCE_DIR}/qutil.cpp
${CMAKE_SOURCE_DIR}/qvault.cpp
${CMAKE_SOURCE_DIR}/qx.cpp
${CMAKE_SOURCE_DIR}/escrow.cpp
${CMAKE_SOURCE_DIR}/sc_utils.cpp
${CMAKE_SOURCE_DIR}/test_utils.cpp
${CMAKE_SOURCE_DIR}/wallet_utils.cpp
Expand Down Expand Up @@ -54,6 +55,7 @@ SET(HEADER_FILES
qutil.h
qvault.h
qx.h
escrow.h
qx_struct.h
sanity_check.h
sc_utils.h
Expand Down
93 changes: 93 additions & 0 deletions argparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,25 @@ void print_help()
printf("\t-qbondgetcfa\n");
printf("\t\tGet list of commission free addresses.\n");

printf("\n[ESCROW COMMANDS]\n");
printf("\t-escrowcreatedeal <ACCEPTOR_ID> <OFFERED_ASSETS> <REQUESTED_ASSETS>\n");
printf("\t\tCreate deal.\n");
printf("\t\t<ACCEPTOR_ID> is identity to which the deal is offered.\n");
printf("\t\t<OFFERED_ASSETS> in format QUAmount:name1,issuer1,amount1:name2,issuer2,amount2... Minimum 1 asset, maximum 4 assets (not including QU).\n");
printf("\t\t<REQUESTED_ASSETS> in format QUAmount:name1,issuer1,amount1:name2,issuer2,amount2... Minimum 1 asset, maximum 4 assets (not including QU).\n");
printf("\t-escrowacceptdeal <DEAL_INDEX>\n");
printf("\t\tAccept deal with index. The deal index can be obtained through -escrowgetdeals.\n");
printf("\t-escrowmakedealpublic <DEAL_INDEX>\n");
printf("\t\tRemove a specific acceptor for the deal and make it open to all users. The deal index can be obtained through -escrowgetdeals.\n");
printf("\t-escrowcanceldeal <DEAL_INDEX>\n");
printf("\t\tCancel the deal. The deal index can be obtained through -escrowgetdeals.\n");
printf("\t-escrowtransferrights <ASSET_NAME> <ISSUER_ID> <NEW_MANAGING_CONTRACT> <NUMBER_OF_SHARES>\n");
printf("\t\tTransfer asset management rights of shares from ESCROW to another contract.\n");
printf("\t-escrowgetdeals <PROPOSED_OFFSET> <PUBLIC_OFFSET>\n");
printf("\t\tGet owned, proposed and public deals. Seed required.\n");
printf("\t-escrowgetfreeasset <ASSET_NAME> <ISSUER>\n");
printf("\t\tGet unblocked assets amount.\n");

printf("\n[TESTING COMMANDS]\n");
printf("\t-testqpifunctionsoutput\n");
printf("\t\tTest that output of qpi functions matches TickData and quorum tick votes for 15 ticks in the future (as specified by scheduletick offset). Requires the TESTEXA SC to be enabled.\n");
Expand Down Expand Up @@ -2677,6 +2696,80 @@ void parseArgument(int argc, char** argv)
break;
}

/*************************
**** ESCROW COMMANDS ****
*************************/

if (strcmp(argv[i], "-escrowcreatedeal") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(3)
g_cmd = ESCROW_CREATE_DEAL_CMD;
g_escrowAcceptorId = argv[i + 1];
g_escrow_offeredAssetsCommaSeparated = argv[i + 2];
g_escrow_requestedAssetsCommaSeparated = argv[i + 3];
i += 4;
CHECK_OVER_PARAMETERS
return;
}
if (strcmp(argv[i], "-escrowgetdeals") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(2)
g_cmd = ESCROW_GET_DEALS_CMD;
g_escrow_proposedOffset = charToNumber(argv[i + 1]);
g_escrow_publicOffset = charToNumber(argv[i + 2]);
i += 3;
CHECK_OVER_PARAMETERS
return;
}
if (strcmp(argv[i], "-escrowacceptdeal") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(1)
g_cmd = ESCROW_ACCEPT_DEAL_CMD;
g_escrow_dealIndex = charToNumber(argv[i + 1]);
i += 2;
CHECK_OVER_PARAMETERS
return;
}
if (strcmp(argv[i], "-escrowmakedealpublic") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(1)
g_cmd = ESCROW_MAKE_DEAL_PUBLIC_CMD;
g_escrow_dealIndex = charToNumber(argv[i + 1]);
i += 2;
CHECK_OVER_PARAMETERS
return;
}
if (strcmp(argv[i], "-escrowcanceldeal") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(1)
g_cmd = ESCROW_CANCEL_DEAL_CMD;
g_escrow_dealIndex = charToNumber(argv[i + 1]);
i += 2;
CHECK_OVER_PARAMETERS
return;
}
if (strcmp(argv[i], "-escrowtransferrights") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(4)
g_cmd = ESCROW_TRANSFER_RIGHTS_CMD;
g_escrow_assetName = argv[i + 1];
g_escrow_issuer = argv[i + 2];
g_contractIndex = getContractIndex(argv[i + 3], g_enableTestContracts);
g_escrow_amount = charToNumber(argv[i + 4]);
i += 5;
CHECK_OVER_PARAMETERS
return;
}
if (strcmp(argv[i], "-escrowgetfreeasset") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(2)
g_cmd = ESCROW_GET_FREE_ASSET_CMD;
g_escrow_assetName = argv[i + 1];
g_escrow_issuer = argv[i + 2];
i += 3;
CHECK_OVER_PARAMETERS
return;
}

/*****************************************
***** SHAREHOLDER PROPOSAL COMMANDS *****
Expand Down
6 changes: 6 additions & 0 deletions connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "nostromo.h"
#include "qutil.h"
#include "qbond.h"
#include "escrow.h"


#ifdef _MSC_VER
Expand Down Expand Up @@ -402,6 +403,11 @@ template GetFees_output QubicConnection::receivePacketWithHeaderAs<GetFees_outpu
template GetEarnedFees_output QubicConnection::receivePacketWithHeaderAs<GetEarnedFees_output>();
template GetCFA_output QubicConnection::receivePacketWithHeaderAs<GetCFA_output>();

// ESCROW
template EscrowGetDeals_output QubicConnection::receivePacketWithHeaderAs<EscrowGetDeals_output>();
template TransferShareManagementRights_output QubicConnection::receivePacketWithHeaderAs<TransferShareManagementRights_output>();
template EscrowGetFreeAsset_output QubicConnection::receivePacketWithHeaderAs<EscrowGetFreeAsset_output>();

// TESTING
template QpiFunctionsOutput QubicConnection::receivePacketWithHeaderAs<QpiFunctionsOutput>();

Expand Down
Loading
Loading