-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathAddress.h
executable file
·150 lines (118 loc) · 3.72 KB
/
Address.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
#ifndef TX_ADDRESS_H
#define TX_ADDRESS_H
#include <cstdint>
#include "UAmount.h"
#include "Scripts/UScript.h"
#include "Serialization/streams.h"
#include "Crypto/Hash160.h"
#include "ChainParams.h"
class Address {
protected:
UScript script;
public:
UScript getScript();
void setScript(UScript script);
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(script);
}
};
class DscToAddressLink {
private:
std::vector<unsigned char> dscCertificate;
uint32_t DSCLinkedAtHeight = 0;
std::vector<unsigned char> passportHash;
uint32_t deactivatedAtHeight = 0;
public:
const std::vector<unsigned char> &getDscCertificate() const {
return dscCertificate;
}
void setDscCertificate(const std::vector<unsigned char> &dscCertificate) {
DscToAddressLink::dscCertificate = dscCertificate;
}
uint32_t getDSCLinkedAtHeight() const {
return DSCLinkedAtHeight;
}
void setDSCLinkedAtHeight(uint32_t DSCLinkedAtHeight) {
DscToAddressLink::DSCLinkedAtHeight = DSCLinkedAtHeight;
}
const std::vector<unsigned char> &getPassportHash() const {
return passportHash;
}
void setPassportHash(const std::vector<unsigned char> &passportHash) {
DscToAddressLink::passportHash = passportHash;
}
uint32_t getDeactivatedAtHeight() const {
return deactivatedAtHeight;
}
void setDeactivatedAtHeight(uint32_t deactivatedAtHeight) {
DscToAddressLink::deactivatedAtHeight = deactivatedAtHeight;
}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(dscCertificate);
READWRITE(DSCLinkedAtHeight);
READWRITE(passportHash);
READWRITE(deactivatedAtHeight);
}
};
class AddressForStore : public Address {
private:
std::vector<DscToAddressLink> dscToAddressLinks;
UAmount UBIdebit;
UAmount amount;
uint32_t nonce = 0;
uint8_t additionalPassportScans = 0;
uint64_t lockedUntil = 0;
public:
UAmount getAmount() {
return amount;
}
void setAmount(UAmount amount) {
AddressForStore::amount = amount;
}
uint32_t getNonce() {
return nonce;
}
void setNonce(uint32_t nonce) {
AddressForStore::nonce = nonce;
}
UAmount getUBIdebit() {
return UBIdebit;
}
void setUBIdebit(UAmount UBIdebit) {
AddressForStore::UBIdebit = UBIdebit;
}
std::vector<DscToAddressLink> getDscToAddressLinks() const {
return dscToAddressLinks;
}
void setDscToAddressLinks(const std::vector<DscToAddressLink> dscToAddressLinks) {
AddressForStore::dscToAddressLinks = dscToAddressLinks;
}
uint8_t getAdditionalPassportScans() const {
return additionalPassportScans;
}
void setAdditionalPassportScans(uint8_t additionalPassportScans) {
AddressForStore::additionalPassportScans = additionalPassportScans;
}
uint64_t getLockedUntil() const {
return lockedUntil;
}
void setLockedUntil(uint64_t lockedUntil) {
AddressForStore::lockedUntil = lockedUntil;
}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(nonce);
READWRITE(script);
READWRITE(dscToAddressLinks);
READWRITE(UBIdebit);
READWRITE(amount);
READWRITE(additionalPassportScans);
READWRITE(lockedUntil); // Timestamp field untill when the coins on the address cannot be spent (Not implemented)
}
};
#endif //TX_ADDRESS_H