forked from qubic/qubic-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqutil.h
More file actions
152 lines (126 loc) · 3.85 KB
/
qutil.h
File metadata and controls
152 lines (126 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#pragma once
#include "structs.h"
#include "stdint.h"
// Constants for poll operations
constexpr uint64_t QUTIL_POLL_TYPE_QUBIC = 1;
constexpr uint64_t QUTIL_POLL_TYPE_ASSET = 2;
constexpr uint64_t QUTIL_MAX_ASSETS_PER_POLL = 16;
constexpr uint64_t QUTIL_MAX_POLL = 128;
constexpr uint64_t QUTIL_MAX_OPTIONS = 64;
constexpr int64_t QUTIL_VOTE_FEE = 100LL;
constexpr int64_t QUTIL_POLL_CREATION_FEE = 10000000LL;
namespace qpi
{
struct Asset
{
uint8_t issuer[32];
uint64_t assetName;
};
}
struct CreatePoll_input
{
uint8_t poll_name[32];
uint64_t poll_type;
uint64_t min_amount;
uint8_t github_link[256];
qpi::Asset allowed_assets[QUTIL_MAX_ASSETS_PER_POLL];
uint64_t num_assets;
};
struct QUtilPoll {
uint8_t poll_name[32];
uint64_t poll_type;
uint64_t min_amount;
uint64_t is_active;
uint8_t creator[32];
qpi::Asset allowed_assets[QUTIL_MAX_ASSETS_PER_POLL];
uint64_t num_assets;
};
struct Vote_input
{
uint64_t poll_id;
uint8_t address[32];
uint64_t amount;
uint64_t chosen_option;
};
struct GetCurrentResult_input
{
uint64_t poll_id;
};
struct GetPollsByCreator_input
{
uint8_t creator[32];
};
struct GetPollInfo_input {
uint64_t poll_id;
};
struct GetCurrentResult_output
{
uint64_t votes[QUTIL_MAX_OPTIONS];
uint64_t voter_count[QUTIL_MAX_OPTIONS];
uint64_t is_active;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct GetPollsByCreator_output
{
uint64_t poll_ids[QUTIL_MAX_POLL];
uint64_t num_polls;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct GetCurrentPollId_output {
uint64_t current_poll_id;
uint64_t active_poll_ids[QUTIL_MAX_POLL];
uint64_t active_count;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct GetPollInfo_output
{
uint64_t found;
QUtilPoll poll_info;
uint8_t poll_link[256];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct CancelPoll_input {
uint64_t poll_id;
};
enum qutilProcedureId
{
SendToManyV1 = 1,
BurnQubic = 2,
SendToManyBenchmark = 3,
CreatePoll = 4,
Vote = 5,
CancelPoll = 6,
};
enum qutilFunctionId
{
GetSendToManyV1Fee = 1,
GetTotalNumberOfAssetShares = 2,
GetCurrentResult = 3,
GetPollsByCreator = 4,
GetCurrentPollId = 5,
GetPollInfo = 6,
};
void qutilSendToManyV1(const char* nodeIp, int nodePort, const char* seed, const char* payoutListFile, uint32_t scheduledTickOffset);
void qutilBurnQubic(const char* nodeIp, int nodePort, const char* seed, long long amount, uint32_t scheduledTickOffset);
void qutilSendToManyBenchmark(const char* nodeIp, int nodePort, const char* seed, uint32_t destinationCount, uint32_t numTransfersEach, uint32_t scheduledTickOffset);
void qutilGetTotalNumberOfAssetShares(const char* nodeIp, int nodePort, const char* issuerIdentity, const char* assetName);
void qutilCreatePoll(const char* nodeIp, int nodePort, const char* seed,
const char* poll_name, uint64_t poll_type, uint64_t min_amount,
const char* github_link, const char* semicolon_separated_assets,
uint32_t scheduledTickOffset);
void qutilVote(const char* nodeIp, int nodePort, const char* seed,
uint64_t poll_id, uint64_t amount, uint64_t chosen_option,
uint32_t scheduledTickOffset);
void qutilGetCurrentResult(const char* nodeIp, int nodePort, uint64_t poll_id);
void qutilGetPollsByCreator(const char* nodeIp, int nodePort, const char* creator_address);
void qutilGetCurrentPollId(const char* nodeIp, int nodePort);
void qutilGetPollInfo(const char* nodeIp, int nodePort, uint64_t poll_id);
void qutilCancelPoll(const char* nodeIp, int nodePort, const char* seed, uint64_t poll_id, uint32_t scheduledTickOffset);