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
156 lines (138 loc) · 4.31 KB
/
msvault.h
File metadata and controls
156 lines (138 loc) · 4.31 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
#pragma once
#include "structs.h"
#include <cstdint>
#define MSVAULT_CONTRACT_INDEX 11
#define MSVAULT_MAX_OWNERS 16
#define MSVAULT_MAX_COOWNER 8
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 {
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultDeposit_input {
uint64_t vaultID;
};
struct MsVaultDeposit_output {
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultReleaseTo_input {
uint64_t vaultID;
uint64_t amount;
uint8_t destination[32];
};
struct MsVaultReleaseTo_output {
static constexpr unsigned char type() {
return RespondContractFunction::type();
}
};
struct MsVaultResetRelease_input {
uint64_t vaultID;
};
struct MsVaultResetRelease_output {
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; // always 0 for now
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]; // 16 owners, each 32 bytes
uint64_t requiredApprovals;
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);