-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathqearn.h
150 lines (124 loc) · 3.88 KB
/
qearn.h
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
#pragma once
#include "structs.h"
// SC structs
struct QEarnGetLockInfoPerEpoch_input
{
uint32_t Epoch; /* epoch number to get information */
};
struct QEarnGetLockInfoPerEpoch_output
{
uint64_t LockedAmount; /* initial total locked amount in epoch */
uint64_t BonusAmount; /* initial bonus amount in epoch*/
uint64_t CurrentLockedAmount; /* total locked amount in epoch. exactly the amount excluding the amount unlocked early*/
uint64_t CurrentBonusAmount; /* bonus amount in epoch excluding the early unlocking */
uint64_t Yield; /* Yield calculated by 10000000 multiple*/
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct QEarnGetUserLockedInfo_input
{
uint8_t publicKey[32];
uint32_t epoch;
};
struct QEarnGetUserLockedInfo_output
{
uint64_t LockedAmount;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct QEarnGetStateOfRound_input
{
uint32_t Epoch;
};
struct QEarnGetStateOfRound_output
{
uint32_t state;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct QEarnGetUserLockStatus_input
{
uint8_t publicKey[32];
};
struct QEarnGetUserLockStatus_output
{
uint64_t status;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct QEarnGetStatsPerEpoch_input {
uint32_t epoch;
};
struct QEarnGetStatsPerEpoch_output {
uint64_t earlyUnlockedAmount;
uint64_t earlyUnlockedPercent;
uint64_t totalLockedAmount;
uint64_t averageAPY;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct QEarnGetBurnedAndBoostedStats_input {
uint32_t t;
};
struct QEarnGetBurnedAndBoostedStats_output {
uint64_t burnedAmount;
uint64_t averageBurnedPercent;
uint64_t boostedAmount;
uint64_t averageBoostedPercent;
uint64_t rewardedAmount;
uint64_t averageRewardedPercent;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct QEarnGetBurnedAndBoostedStatsPerEpoch_input {
uint32_t epoch;
};
struct QEarnGetBurnedAndBoostedStatsPerEpoch_output {
uint64_t burnedAmount;
uint64_t burnedPercent;
uint64_t boostedAmount;
uint64_t boostedPercent;
uint64_t rewardedAmount;
uint64_t rewardedPercent;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
struct QEarnGetEndedStatus_input
{
uint8_t publicKey[32];
};
struct QEarnGetEndedStatus_output
{
uint64_t Fully_Unlocked_Amount;
uint64_t Fully_Rewarded_Amount;
uint64_t Early_Unlocked_Amount;
uint64_t Early_Rewarded_Amount;
static constexpr unsigned char type()
{
return RespondContractFunction::type();
}
};
void qearnLock(const char* nodeIp, int nodePort, const char* seed, long long lock_amount, uint32_t scheduledTickOffset);
void qearnUnlock(const char* nodeIp, int nodePort, const char* seed, long long unlock_amount, uint32_t locked_epoch, uint32_t scheduledTickOffset);
void qearnGetInfoPerEpoch(const char* nodeIp, int nodePort, uint32_t epoch);
void qearnGetUserLockedInfo(const char* nodeIp, int nodePort,char* Identity, uint32_t epoch);
void qearnGetStateOfRound(const char* nodeIp, int nodePort, uint32_t epoch);
void qearnGetUserLockedStatus(const char* nodeIp, int nodePort,char* Identity);
void qearnGetEndedStatus(const char* nodeIp, int nodePort,char* Identity);
void qearnGetStatsPerEpoch(const char* nodeIp, int nodePort, uint32_t epoch);
void qearnGetBurnedAndBoostedStats(const char* nodeIp, int nodePort);
void qearnGetBurnedAndBoostedStatsPerEpoch(const char* nodeIp, int nodePort, uint32_t epoch);