-
Notifications
You must be signed in to change notification settings - Fork 1
/
Stellar-operation-check-sale-state.x
124 lines (107 loc) · 2.44 KB
/
Stellar-operation-check-sale-state.x
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
// Copyright 2015 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
%#include "xdr/Stellar-ledger-entries.h"
%#include "xdr/Stellar-operation-manage-offer.h"
namespace stellar
{
/* CheckSaleState
Closes or cancels sale if conditions for that are met.
Threshold: med
Result: CheckSaleStateResult
*/
struct CheckSaleStateOp
{
uint64 saleID;
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
/******* CheckSaleState Result ********/
enum CheckSaleStateResultCode
{
// codes considered as "success" for the operation
SUCCESS = 0, // sale was processed
// codes considered as "failure" for the operation
NOT_FOUND = -1, // sale was not found
NOT_READY = -2 // sale is not ready to be closed or canceled
};
enum CheckSaleStateEffect {
CANCELED = 1, // sale did not managed to go over soft cap in time
CLOSED = 2, // sale met hard cap or (end time and soft cap)
UPDATED = 3 // on check sale was modified and modifications must be saved
};
struct SaleCanceled {
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
struct SaleUpdated {
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
struct CheckSubSaleClosedResult {
BalanceID saleBaseBalance;
BalanceID saleQuoteBalance;
ManageOfferSuccessResult saleDetails;
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
struct CheckSaleClosedResult {
AccountID saleOwner;
CheckSubSaleClosedResult results<>;
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
struct CheckSaleStateSuccess
{
uint64 saleID;
union switch (CheckSaleStateEffect effect)
{
case CANCELED:
SaleCanceled saleCanceled;
case CLOSED:
CheckSaleClosedResult saleClosed;
case UPDATED:
SaleUpdated saleUpdated;
}
effect;
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
union CheckSaleStateResult switch (CheckSaleStateResultCode code)
{
case SUCCESS:
CheckSaleStateSuccess success;
default:
void;
};
}