-
Notifications
You must be signed in to change notification settings - Fork 4
/
info.h
86 lines (67 loc) · 2.13 KB
/
info.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
// Copyright 2018 AtomicSwap Solutions Ltd. All rights reserved.
// Use of this source code is governed by Microsoft Reference Source
// License (MS-RSL) that can be found in the LICENSE file.
#ifndef INFO_H
#define INFO_H
#include <memory>
#include <QString>
#include <QJsonObject>
struct OrderInfo;
typedef std::shared_ptr<OrderInfo> OrderInfoPtr;
struct OrderInfo {
OrderInfo() {}
OrderInfo(long long orderId, const QJsonObject& order);
long long orderId_;
QString sendCur_;
long long sendCount_;
QString getCur_;
long long getCount_;
QString getAddress_;
QString getJson() const;
void sign(const QString& key);
bool checkKey(const QString& key);
const QString& getHash() const { return keyHash_; }
void setHash(const QString& keyHash) { keyHash_ = keyHash; }
private:
QString keyHash_;
};
struct TradeInfo {
TradeInfo() {}
TradeInfo(long long tradeId, OrderInfoPtr order, const QString& initiatorAddress) :
tradeId_(tradeId),
order_(order),
initiatorAddress_(initiatorAddress),
initiatorCommissionPaid_(false),
participantCommissionPaid_(false),
refundedInit_(false),
refundedPart_(false),
refundTimeInit_(0),
refundTimePart_(0)
{}
long long tradeId_;
OrderInfoPtr order_;
QString initiatorAddress_;
QString secretHash_;
QString contractInitiator_;
QString contractParticipant_;
QString initiatorContractTransaction_;
QString participantContractTransaction_;
QString initiatorRedemptionTransaction_;
QString participantRedemptionTransaction_;
bool initiatorCommissionPaid_;
bool participantCommissionPaid_;
bool refundedInit_;
bool refundedPart_;
long long refundTimeInit_;
long long refundTimePart_;
QString getJson() const;
void sign(const QString& key);
bool checkKey(const QString& key);
bool checkOrderKey(const QString& key);
const QString& getHash() const { return keyHash_; }
void setHash(const QString& keyHash) { keyHash_ = keyHash; }
bool isComplited() const;
private:
QString keyHash_;
};
#endif // INFO_H