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
70 changes: 52 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,58 @@ Commands:
You need to own/possess the shares to do this (seed required).

[QTRY COMMANDS]
-qtrygetbasicinfo
Show qtry basic info from a node.
-qtryissuebet
Issue a bet (prompt mode)
-qtrygetactivebet
Show all active bet id.
-qtrygetactivebetbycreator <BET_CREATOR_ID>
Show all active bet id of an ID.
-qtrygetbetinfo <BET_ID>
Get meta information of a bet
-qtrygetbetdetail <BET_ID> <OPTION_ID>
Get a list of IDs that bet on <OPTION_ID> of the bet <BET_ID>
-qtryjoinbet <BET_ID> <NUMBER_OF_BET_SLOT> <AMOUNT_PER_SLOT> <PICKED_OPTION>
Join a bet
-qtrypublishresult <BET_ID> <WIN_OPTION>
(Oracle providers only) publish a result for a bet
-qtrycancelbet <BET_ID>
(Game operator only) cancel a bet
Format: -qtry [subcommand for QTRY] [other params]
-qtry getbasicinfo
Show Quottery basic info from a node (fees, revenues, game operator, anti-spam amount, etc.).
-qtry getactiveeventsid
Show recent active event IDs.
-qtry createevent [EVENT_DESC] [OPTION_0_DESC] [OPTION_1_DESC] [END_DATE] [TAG_ID]
Create a new Quottery event. EVENT_DESC max 126 bytes, OPTION_*_DESC max 64 bytes each. Game operator only.
END_DATE format: \"YYYY-MM-DD hh:mm:ss\" (UTC). TAG_ID is a uint16 category tag.
-qtry order add/remove bid/ask [EVENT_ID] [OPTION] [AMOUNT] [PRICE]
Place or remove a bid/ask order on Quottery. OPTION must be 0 or 1.
-qtry getorder bid/ask [EVENT_ID] [OPTION] [OFFSET]
Get bid/ask orders for an event option, paginated by OFFSET.
-qtry getposition [IDENTITY]
Get all positions held by an identity on Quottery.
-qtry geteventinfo [EVENT_ID]
Get detailed info for a single event (description, options, dates, result, dispute state).
-qtry geteventinfobatch [EVENT_ID_1] [EVENT_ID_2] ... [EVENT_ID_N]
Get detailed info for up to 64 events in one request.
-qtry publishresult [EVENT_ID] [OPTION_ID]
Publish the result for an event. OPTION_ID must be 0 or 1. Game operator only.
Requires the event's end date to have passed. Locks the dispute deposit amount.
-qtry tryfinalizeevent [EVENT_ID]
Finalize an event after the dispute window (~1000 ticks past publish). Game operator only.
-qtry dispute [EVENT_ID]
Dispute a published result. Requires the dispute deposit amount; only valid before finalization.
-qtry resolvedispute [EVENT_ID] [VOTE]
Resolve a dispute by voting (VOTE: 0 = No, 1 = Yes). Computor only.
Requires a small invocation reward (refunded if caller is a computor).
-qtry claimreward [EVENT_ID]
Claim reward for a winning position in a finalized event. Requires a 1,000,000 qu fee
(refunded only if you have a winning position; otherwise lost as anti-spam).
-qtry forceclaimreward [EVENT_ID] [IDENTITY_1] [IDENTITY_2] ... [IDENTITY_16]
Force-claim rewards on behalf of up to 16 identities. Game operator only.
-qtry transfersharemgmt [ISSUER_IDENTITY] [ASSET_NAME] [NUMBER_OF_SHARES] [NEW_MANAGING_CONTRACT_INDEX]
Transfer asset share management rights from Quottery to another contract.
-qtry cleanmemory
Finalize events with published results past dispute window and clean up state. Game operator only.
-qtry transferqusd [RECEIVER_IDENTITY] [AMOUNT]
Transfer QUSD (GARTH) via the Quottery contract.
-qtry transferqtrygov [RECEIVER_IDENTITY] [AMOUNT]
Transfer QTRYGOV tokens via the Quottery contract. AMOUNT must be positive.
-qtry updatediscount [USER_IDENTITY] set [NEW_FEE_RATE]
-qtry updatediscount [USER_IDENTITY] remove
Set or remove a fee discount for a user. Game operator only.
NEW_FEE_RATE is in tenths of a percent (max 1000 = 100%%).
-qtry proposalvote [OPERATION_FEE] [SHAREHOLDER_FEE] [BURN_FEE] [FEE_PER_DAY] [DEPOSIT_FOR_DISPUTE] [OPERATION_ID_IDENTITY]
Cast a governance proposal vote with the proposed parameters. Costs the anti-spam amount. QTRYGOV holder only.
Fees are in tenths of a percent (e.g. 50 = 5.0%%).
-qtry getapprovedamount [IDENTITY]
Get the approved QUSD amount for an identity.
-qtry gettopproposals
Get the top governance proposals (up to 3) for the current epoch.

[GENERAL QUORUM PROPOSAL COMMANDS]
-gqmpropsetproposal <PROPOSAL_STRING>
Expand Down
154 changes: 57 additions & 97 deletions argparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,24 +216,58 @@ void print_help()
printf("\t\tTransfer asset management rights of shares from QX to another contract. <NEW_MANAGING_CONTRACT> can be given as name or index. You need to own/possess the shares to do this (seed required).\n");

printf("\n[QTRY COMMANDS]\n");
printf("\t-qtrygetbasicinfo\n");
printf("\t\tShow qtry basic info from a node.\n");
printf("\t-qtryissuebet\n");
printf("\t\tIssue a bet (prompt mode)\n");
printf("\t-qtrygetactivebet\n");
printf("\t\tShow all active bet id.\n");
printf("\t-qtrygetactivebetbycreator <BET_CREATOR_ID>\n");
printf("\t\tShow all active bet id of an ID.\n");
printf("\t-qtrygetbetinfo <BET_ID>\n");
printf("\t\tGet meta information of a bet\n");
printf("\t-qtrygetbetdetail <BET_ID> <OPTION_ID>\n");
printf("\t\tGet a list of IDs that bet on <OPTION_ID> of the bet <BET_ID>\n");
printf("\t-qtryjoinbet <BET_ID> <NUMBER_OF_BET_SLOT> <AMOUNT_PER_SLOT> <PICKED_OPTION>\n");
printf("\t\tJoin a bet\n");
printf("\t-qtrypublishresult <BET_ID> <WIN_OPTION>\n");
printf("\t\t(Oracle providers only) publish a result for a bet\n");
printf("\t-qtrycancelbet <BET_ID>\n");
printf("\t\t(Game operator only) cancel a bet\n");
printf("\tFormat: -qtry [subcommand for QTRY] [other params]\n");
Comment thread
deni-x-00 marked this conversation as resolved.
printf("\t-qtry getbasicinfo\n");
printf("\t\tShow Quottery basic info from a node (fees, revenues, game operator, anti-spam amount, etc.).\n");
printf("\t-qtry getactiveeventsid\n");
printf("\t\tShow recent active event IDs.\n");
printf("\t-qtry createevent [EVENT_DESC] [OPTION_0_DESC] [OPTION_1_DESC] [END_DATE] [TAG_ID]\n");
printf("\t\tCreate a new Quottery event. EVENT_DESC max 126 bytes, OPTION_*_DESC max 64 bytes each. Game operator only.\n");
printf("\t\tEND_DATE format: \"YYYY-MM-DD hh:mm:ss\" (UTC). TAG_ID is a uint16 category tag.\n");
printf("\t-qtry order add/remove bid/ask [EVENT_ID] [OPTION] [AMOUNT] [PRICE]\n");
printf("\t\tPlace or remove a bid/ask order on Quottery. OPTION must be 0 or 1.\n");
printf("\t-qtry getorder bid/ask [EVENT_ID] [OPTION] [OFFSET]\n");
printf("\t\tGet bid/ask orders for an event option, paginated by OFFSET.\n");
printf("\t-qtry getposition [IDENTITY]\n");
printf("\t\tGet all positions held by an identity on Quottery.\n");
printf("\t-qtry geteventinfo [EVENT_ID]\n");
printf("\t\tGet detailed info for a single event (description, options, dates, result, dispute state).\n");
printf("\t-qtry geteventinfobatch [EVENT_ID_1] [EVENT_ID_2] ... [EVENT_ID_N]\n");
printf("\t\tGet detailed info for up to 64 events in one request.\n");
printf("\t-qtry publishresult [EVENT_ID] [OPTION_ID]\n");
printf("\t\tPublish the result for an event. OPTION_ID must be 0 or 1. Game operator only.\n");
printf("\t\tRequires the event's end date to have passed. Locks the dispute deposit amount.\n");
printf("\t-qtry tryfinalizeevent [EVENT_ID]\n");
printf("\t\tFinalize an event after the dispute window (~1000 ticks past publish). Game operator only.\n");
printf("\t-qtry dispute [EVENT_ID]\n");
printf("\t\tDispute a published result. Requires the dispute deposit amount; only valid before finalization.\n");
printf("\t-qtry resolvedispute [EVENT_ID] [VOTE]\n");
printf("\t\tResolve a dispute by voting (VOTE: 0 = No, 1 = Yes). Computor only.\n");
printf("\t\tRequires a small invocation reward (refunded if caller is a computor).\n");
printf("\t-qtry claimreward [EVENT_ID]\n");
printf("\t\tClaim reward for a winning position in a finalized event. Requires a 1,000,000 qu fee\n");
printf("\t\t(refunded only if you have a winning position; otherwise lost as anti-spam).\n");
printf("\t-qtry forceclaimreward [EVENT_ID] [IDENTITY_1] [IDENTITY_2] ... [IDENTITY_16]\n");
printf("\t\tForce-claim rewards on behalf of up to 16 identities. Game operator only.\n");
printf("\t-qtry transfersharemgmt [ISSUER_IDENTITY] [ASSET_NAME] [NUMBER_OF_SHARES] [NEW_MANAGING_CONTRACT_INDEX]\n");
printf("\t\tTransfer asset share management rights from Quottery to another contract.\n");
printf("\t-qtry cleanmemory\n");
printf("\t\tFinalize events with published results past dispute window and clean up state. Game operator only.\n");
printf("\t-qtry transferqusd [RECEIVER_IDENTITY] [AMOUNT]\n");
printf("\t\tTransfer QUSD (GARTH) via the Quottery contract.\n");
printf("\t-qtry transferqtrygov [RECEIVER_IDENTITY] [AMOUNT]\n");
printf("\t\tTransfer QTRYGOV tokens via the Quottery contract. AMOUNT must be positive.\n");
printf("\t-qtry updatediscount [USER_IDENTITY] set [NEW_FEE_RATE]\n");
printf("\t-qtry updatediscount [USER_IDENTITY] remove\n");
printf("\t\tSet or remove a fee discount for a user. Game operator only.\n");
printf("\t\tNEW_FEE_RATE is in tenths of a percent (max 1000 = 100%%).\n");
printf("\t-qtry proposalvote [OPERATION_FEE] [SHAREHOLDER_FEE] [BURN_FEE] [FEE_PER_DAY] [DEPOSIT_FOR_DISPUTE] [OPERATION_ID_IDENTITY]\n");
printf("\t\tCast a governance proposal vote with the proposed parameters. Costs the anti-spam amount. QTRYGOV holder only.\n");
printf("\t\tFees are in tenths of a percent (e.g. 50 = 5.0%%).\n");
printf("\t-qtry getapprovedamount [IDENTITY]\n");
printf("\t\tGet the approved QUSD amount for an identity.\n");
printf("\t-qtry gettopproposals\n");
printf("\t\tGet the top governance proposals (up to 3) for the current epoch.\n");

printf("\n[GENERAL QUORUM PROPOSAL COMMANDS]\n");
printf("\t-gqmpropsetproposal <PROPOSAL_STRING>\n");
Expand Down Expand Up @@ -1398,85 +1432,11 @@ void parseArgument(int argc, char** argv)
/*************************
***** QTRY COMMANDS *****
*************************/

if (strcmp(argv[i], "-qtryissuebet") == 0)
{
g_cmd = QUOTTERY_ISSUE_BET;
i+=1;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtryjoinbet") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(4)
g_cmd = QUOTTERY_JOIN_BET;
g_quottery_betId = uint32_t(charToNumber(argv[i + 1]));
g_quottery_numberBetSlot = charToNumber(argv[i+2]);
g_quottery_amountPerBetSlot = charToNumber(argv[i+3]);
g_quottery_pickedOption = uint32_t(charToNumber(argv[i+4]));
i+=5;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtrygetbetinfo") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(1)
g_cmd = QUOTTERY_GET_BET_INFO;
g_quottery_betId = uint32_t(charToNumber(argv[i + 1]));
i+=2;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtrygetbetdetail") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(2)
g_cmd = QUOTTERY_GET_BET_DETAIL;
g_quottery_betId = uint32_t(charToNumber(argv[i + 1]));
g_quottery_optionId = uint32_t(charToNumber(argv[i + 2]));
i+=3;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtrygetactivebet") == 0)
{
g_cmd = QUOTTERY_GET_ACTIVE_BET;
i+=1;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtrygetactivebetbycreator") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(1)
g_cmd = QUOTTERY_GET_ACTIVE_BET_BY_CREATOR;
g_quottery_creatorId = argv[i+1];
i+=2;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtrygetbasicinfo") == 0)
{
g_cmd = QUOTTERY_GET_BASIC_INFO;
i+=1;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtrypublishresult") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(2)
g_cmd = QUOTTERY_PUBLISH_RESULT;
g_quottery_betId = uint32_t(charToNumber(argv[i + 1]));
g_quottery_optionId = uint32_t(charToNumber(argv[i + 2]));
i+=3;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-qtrycancelbet") == 0)
{
CHECK_NUMBER_OF_PARAMETERS(1)
g_cmd = QUOTTERY_CANCEL_BET;
g_quottery_betId = uint32_t(charToNumber(argv[i + 1]));
i+=2;
CHECK_OVER_PARAMETERS
if (strcmp(argv[i], "-qtry") == 0) {
g_cmd = QUOTTERY_COMMAND;
int c = 0;
while (i < 128 && i < argc) g_quottery_subcmd[c++] = argv[i++];
g_quottery_subcmd_count = c;
break;
}

Expand Down
12 changes: 8 additions & 4 deletions connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,16 @@ template BroadcastComputors QubicConnection::receivePacketWithHeaderAs<Broadcast
template RespondContractIPO QubicConnection::receivePacketWithHeaderAs<RespondContractIPO>();
template std::vector<RespondActiveIPO> QubicConnection::getLatestVectorPacketAs<RespondActiveIPO>();
template SpecialCommandExecutionFeeMultiplierRequestAndResponse QubicConnection::receivePacketWithHeaderAs<SpecialCommandExecutionFeeMultiplierRequestAndResponse>();
template RespondedEntity QubicConnection::receivePacketWithHeaderAs<RespondedEntity>();
// QUOTTERY
template qtryBasicInfo_output QubicConnection::receivePacketWithHeaderAs<qtryBasicInfo_output>();
template getBetInfo_output QubicConnection::receivePacketWithHeaderAs<getBetInfo_output>();
template getBetOptionDetail_output QubicConnection::receivePacketWithHeaderAs<getBetOptionDetail_output>();
template getActiveBet_output QubicConnection::receivePacketWithHeaderAs<getActiveBet_output>();
template getActiveBetByCreator_output QubicConnection::receivePacketWithHeaderAs<getActiveBetByCreator_output>();
template getEventInfo_output QubicConnection::receivePacketWithHeaderAs<getEventInfo_output>();
template qtryGetOrders_output QubicConnection::receivePacketWithHeaderAs<qtryGetOrders_output>();
template getUserPosition_output QubicConnection::receivePacketWithHeaderAs<getUserPosition_output>();
template getActiveEvent_output QubicConnection::receivePacketWithHeaderAs<getActiveEvent_output>();
template GetEventInfoBatch_output QubicConnection::receivePacketWithHeaderAs<GetEventInfoBatch_output>();
template getApprovedAmount_output QubicConnection::receivePacketWithHeaderAs<getApprovedAmount_output>();
template getTopProposals_output QubicConnection::receivePacketWithHeaderAs<getTopProposals_output>();
// QX
template QxFees_output QubicConnection::receivePacketWithHeaderAs<QxFees_output>();
template qxGetAssetOrder_output QubicConnection::receivePacketWithHeaderAs<qxGetAssetOrder_output>();
Expand Down
17 changes: 16 additions & 1 deletion global.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,27 @@ char* g_qx_assetTransferAssetName = nullptr;
char* g_qx_assetTransferIssuerInHex = nullptr;

// quottery
uint32_t g_quottery_betId = 0;
char* g_quottery_subcmd[128] = { nullptr };
int g_quottery_subcmd_count = 0;
char* g_event_desc = nullptr;
char* g_opt0_desc = nullptr;
char* g_opt1_desc = nullptr;
char* g_end_date_desc = nullptr;
uint32_t g_quottery_eventId = 0;
uint32_t g_quottery_optionId = 0;
char* g_quottery_creatorId = nullptr;
uint64_t g_quottery_numberBetSlot = 0;
uint64_t g_quottery_amountPerBetSlot = 0;
uint32_t g_quottery_pickedOption = 0;
uint64_t g_quottery_option = 0;
uint64_t g_quottery_isBid = 0;
uint64_t g_quottery_amount = 0;
int64_t g_quottery_price = 0;
uint64_t g_quottery_antiSpamAmount = 0;
uint64_t g_quottery_offset = 0;
const char* g_quottery_command1 = nullptr;
const char* g_quottery_command2 = nullptr;
const char* g_quottery_positionIdentity = nullptr;

// qutil
char* g_qutil_sendToManyV1PayoutListFile = nullptr;
Expand Down
40 changes: 2 additions & 38 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,46 +286,10 @@ int run(int argc, char* argv[])
sanityCheckNode(g_nodeIp, g_nodePort);
printActiveIPOs(g_nodeIp, g_nodePort);
break;
case QUOTTERY_ISSUE_BET:
case QUOTTERY_COMMAND:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckSeed(g_seed);
quotteryIssueBet(g_nodeIp, g_nodePort, g_seed, g_offsetScheduledTick);
break;
case QUOTTERY_GET_BET_INFO:
sanityCheckNode(g_nodeIp, g_nodePort);
quotteryPrintBetInfo(g_nodeIp, g_nodePort, g_quottery_betId);
break;
case QUOTTERY_JOIN_BET:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckSeed(g_seed);
quotteryJoinBet(g_nodeIp, g_nodePort, g_seed, g_quottery_betId, int(g_quottery_numberBetSlot), g_quottery_amountPerBetSlot, g_quottery_pickedOption, g_offsetScheduledTick);
break;
case QUOTTERY_GET_BET_DETAIL:
sanityCheckNode(g_nodeIp, g_nodePort);
quotteryPrintBetOptionDetail(g_nodeIp, g_nodePort, g_quottery_betId, g_quottery_optionId);
break;
case QUOTTERY_GET_ACTIVE_BET:
sanityCheckNode(g_nodeIp, g_nodePort);
quotteryPrintActiveBet(g_nodeIp, g_nodePort);
break;
case QUOTTERY_GET_ACTIVE_BET_BY_CREATOR:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckIdentity(g_quottery_creatorId);
quotteryPrintActiveBetByCreator(g_nodeIp, g_nodePort, g_quottery_creatorId);
break;
case QUOTTERY_GET_BASIC_INFO:
sanityCheckNode(g_nodeIp, g_nodePort);
quotteryPrintBasicInfo(g_nodeIp, g_nodePort);
break;
case QUOTTERY_PUBLISH_RESULT:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckSeed(g_seed);
quotteryPublishResult(g_nodeIp, g_nodePort, g_seed, g_quottery_betId, g_quottery_optionId, g_offsetScheduledTick);
break;
case QUOTTERY_CANCEL_BET:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckSeed(g_seed);
quotteryCancelBet(g_nodeIp, g_nodePort, g_seed, g_quottery_betId, g_offsetScheduledTick);
quotteryEntryPoint(g_quottery_subcmd_count, g_quottery_subcmd, g_nodeIp, g_nodePort, g_seed, g_offsetScheduledTick);
break;
case TOOGLE_MAIN_AUX:
sanityCheckNode(g_nodeIp, g_nodePort);
Expand Down
Loading
Loading