forked from qubic/qubic-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsvault.h
More file actions
398 lines (349 loc) · 10.5 KB
/
msvault.h
File metadata and controls
398 lines (349 loc) · 10.5 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
#pragma once
#include "structs.h"
#include <cstdint>
#include "asset_utils.h"
#define MSVAULT_CONTRACT_INDEX 11
#define MSVAULT_MAX_OWNERS 16
#define MSVAULT_MAX_COOWNER 8
#define MSVAULT_MAX_ASSET_TYPES 8
#define MSVAULT_MAX_FEE_VOTES 64
struct MsVaultRegisterVault_input {
uint8_t vaultName[32];
// owners: 32 owners, each 32-byte
uint8_t owners[MSVAULT_MAX_OWNERS * 32];
uint64_t requiredApprovals;
};
struct MsVaultRegisterVault_output {
uint64_t status;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultDeposit_input {
uint64_t vaultID;
};
struct MsVaultDeposit_output {
uint64_t status;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultReleaseTo_input {
uint64_t vaultID;
uint64_t amount;
uint8_t destination[32];
};
struct MsVaultReleaseTo_output {
uint64_t status;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultResetRelease_input {
uint64_t vaultID;
};
struct MsVaultResetRelease_output {
uint64_t status;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetVaults_input {
uint8_t publicKey[32];
};
struct MsVaultGetVaults_output {
uint64_t numberOfVaults;
uint64_t vaultIDs[MSVAULT_MAX_COOWNER];
uint8_t vaultNames[MSVAULT_MAX_COOWNER][32];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetReleaseStatus_input {
uint64_t vaultID;
};
struct MsVaultGetReleaseStatus_output {
uint64_t status;
uint64_t amounts[MSVAULT_MAX_OWNERS];
uint8_t destinations[MSVAULT_MAX_OWNERS][32];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetBalanceOf_input {
uint64_t vaultID;
};
struct MsVaultGetBalanceOf_output {
uint64_t status;
int64_t balance;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetVaultName_input {
uint64_t vaultID;
};
struct MsVaultGetVaultName_output {
uint64_t status;
uint8_t vaultName[32];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetRevenueInfo_input {};
struct MsVaultGetRevenueInfo_output {
uint64_t numberOfActiveVaults;
uint64_t totalRevenue;
uint64_t totalDistributedToShareholders;
uint64_t burnedAmount;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetFees_input {
};
struct MsVaultGetFees_output {
uint64_t registeringFee;
uint64_t releaseFee;
uint64_t releaseResetFee;
uint64_t holdingFee;
uint64_t depositFee;
uint64_t burnFee;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetVaultOwners_input {
uint64_t vaultID;
};
struct MsVaultGetVaultOwners_output {
uint64_t status;
uint64_t numberOfOwners;
uint8_t owners[MSVAULT_MAX_OWNERS][32];
uint64_t requiredApprovals;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct AssetBalance
{
qpi::Asset asset;
uint64_t balance;
};
struct MsVaultDepositAsset_input
{
uint64_t vaultID;
qpi::Asset asset;
uint64_t amount;
};
struct MsVaultDepositAsset_output
{
uint64_t status;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct MsVaultReleaseAssetTo_input
{
uint64_t vaultID;
qpi::Asset asset;
uint64_t amount;
uint8_t destination[32];
};
struct MsVaultReleaseAssetTo_output
{
uint64_t status;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct MsVaultResetAssetRelease_input
{
uint64_t vaultID;
};
struct MsVaultResetAssetRelease_output
{
uint64_t status;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct MsVaultGetVaultAssetBalances_input
{
uint64_t vaultID;
};
struct MsVaultGetVaultAssetBalances_output
{
uint64_t status;
uint64_t numberOfAssetTypes;
AssetBalance assetBalances[MSVAULT_MAX_ASSET_TYPES];
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct MsVaultGetAssetReleaseStatus_input
{
uint64_t vaultID;
};
struct MsVaultGetAssetReleaseStatus_output
{
uint64_t status;
qpi::Asset assets[MSVAULT_MAX_OWNERS];
uint64_t amounts[MSVAULT_MAX_OWNERS];
uint8_t destinations[MSVAULT_MAX_OWNERS][32];
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct MsVaultGetManagedAssetBalance_input
{
qpi::Asset asset;
uint8_t owner[32];
};
struct MsVaultGetManagedAssetBalance_output
{
int64_t balance;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct MsVaultRevokeAssetManagementRights_input
{
qpi::Asset asset;
int64_t numberOfShares;
};
struct MsVaultRevokeAssetManagementRights_output
{
uint64_t status;
int64_t transferredNumberOfShares;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
// Fee Voting structs
struct MsVaultIsShareHolder_input {
uint8_t candidate[32];
};
struct MsVaultIsShareHolder_output {
uint64_t result; // 1 if shareholder, 0 otherwise
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultVoteFeeChange_input {
uint64_t newRegisteringFee;
uint64_t newReleaseFee;
uint64_t newReleaseResetFee;
uint64_t newHoldingFee;
uint64_t newDepositFee;
uint64_t burnFee;
};
struct MsVaultVoteFeeChange_output {
uint64_t status;
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultFeeVote {
uint64_t registeringFee;
uint64_t releaseFee;
uint64_t releaseResetFee;
uint64_t holdingFee;
uint64_t depositFee;
uint64_t burnFee;
};
struct MsVaultGetFeeVotes_input {};
struct MsVaultGetFeeVotes_output {
uint64_t status;
uint64_t numberOfFeeVotes;
MsVaultFeeVote feeVotes[MSVAULT_MAX_FEE_VOTES];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetFeeVotesOwner_input {};
struct MsVaultGetFeeVotesOwner_output {
uint64_t status;
uint64_t numberOfFeeVotes;
uint8_t feeVotesOwner[MSVAULT_MAX_FEE_VOTES][32];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetFeeVotesScore_input {};
struct MsVaultGetFeeVotesScore_output {
uint64_t status;
uint64_t numberOfFeeVotes;
uint64_t feeVotesScore[MSVAULT_MAX_FEE_VOTES];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetUniqueFeeVotes_input {};
struct MsVaultGetUniqueFeeVotes_output {
uint64_t status;
uint64_t numberOfUniqueFeeVotes;
MsVaultFeeVote uniqueFeeVotes[MSVAULT_MAX_FEE_VOTES];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultGetUniqueFeeVotesRanking_input {};
struct MsVaultGetUniqueFeeVotesRanking_output {
uint64_t status;
uint64_t numberOfUniqueFeeVotes;
uint64_t uniqueFeeVotesRanking[MSVAULT_MAX_FEE_VOTES];
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
void msvaultRegisterVault(const char* nodeIp, int nodePort, const char* seed,
uint64_t requiredApprovals, const uint8_t vaultName[32],
const char* ownersCommaSeparated,
uint32_t scheduledTickOffset);
void msvaultDeposit(const char* nodeIp, int nodePort, const char* seed,
uint64_t vaultID, uint64_t amount, uint32_t scheduledTickOffset);
void msvaultReleaseTo(const char* nodeIp, int nodePort, const char* seed,
uint64_t vaultID, uint64_t amount, const char* destinationIdentity,
uint32_t scheduledTickOffset);
void msvaultResetRelease(const char* nodeIp, int nodePort, const char* seed,
uint64_t vaultID, uint32_t scheduledTickOffset);
void msvaultGetVaults(const char* nodeIp, int nodePort, const char* identity);
void msvaultGetReleaseStatus(const char* nodeIp, int nodePort, uint64_t vaultID);
void msvaultGetBalanceOf(const char* nodeIp, int nodePort, uint64_t vaultID);
void msvaultGetVaultName(const char* nodeIp, int nodePort, uint64_t vaultID);
void msvaultGetRevenueInfo(const char* nodeIp, int nodePort);
void msvaultGetFees(const char* nodeIp, int nodePort);
void msvaultGetVaultOwners(const char* nodeIp, int nodePort, uint64_t vaultID);
void msvaultDepositAsset(const char* nodeIp, int nodePort, const char* seed,
uint64_t vaultID, const char* assetName, const char* issuer, uint64_t amount,
uint32_t scheduledTickOffset);
void msvaultReleaseAssetTo(const char* nodeIp, int nodePort, const char* seed,
uint64_t vaultID, const char* assetName, const char* issuer, uint64_t amount, const char* destination,
uint32_t scheduledTickOffset);
void msvaultResetAssetRelease(const char* nodeIp, int nodePort, const char* seed,
uint64_t vaultID, uint32_t scheduledTickOffset);
void msvaultGetVaultAssetBalances(const char* nodeIp, int nodePort, uint64_t vaultID);
void msvaultGetAssetReleaseStatus(const char* nodeIp, int nodePort, uint64_t vaultID);
void msvaultGetManagedAssetBalance(const char* nodeIp, int nodePort, const char* assetName, const char* issuer, const char* owner);
void msvaultRevokeAssetManagementRights(const char* nodeIp, int nodePort, const char* seed,
const char* assetName, const char* issuer, int64_t numberOfShares,
uint32_t scheduledTickOffset);
// Fee votings
void msvaultIsShareHolder(const char* nodeIp, int nodePort, const char* identity);
void msvaultVoteFeeChange(const char* nodeIp, int nodePort, const char* seed,
uint64_t newRegisteringFee, uint64_t newReleaseFee, uint64_t newReleaseResetFee,
uint64_t newHoldingFee, uint64_t newDepositFee, uint64_t burnFee,
uint32_t scheduledTickOffset);
void msvaultGetFeeVotes(const char* nodeIp, int nodePort);
void msvaultGetFeeVotesOwner(const char* nodeIp, int nodePort);
void msvaultGetFeeVotesScore(const char* nodeIp, int nodePort);
void msvaultGetUniqueFeeVotes(const char* nodeIp, int nodePort);
void msvaultGetUniqueFeeVotesRanking(const char* nodeIp, int nodePort);