-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoperation-review-request.x
437 lines (385 loc) · 12.5 KB
/
operation-review-request.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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
%#include "xdr/ledger-entries.h"
%#include "xdr/operation-payment.h"
%#include "xdr/operation-manage-offer.h"
%#include "xdr/operation-create-redemption-request.h"
%#include "xdr/operation-create-close-deferred-payment-request.h"
namespace stellar
{
//: Actions that can be performed on request that is being reviewed
enum ReviewRequestOpAction {
//: Approve request
APPROVE = 1,
//: Reject request
REJECT = 2,
//: Permanently reject request
PERMANENT_REJECT = 3
};
/* ReviewRequestOp
Approves or rejects reviewable request
Threshold: high
Result: ReviewRequestResult
*/
//: Review details of a Limits Update request
struct LimitsUpdateDetails {
//: Limits entry containing new limits to set
LimitsV2Entry newLimitsV2;
//:reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Review details of a Withdraw Request
struct WithdrawalDetails {
//: External details updated on a Withdraw review
string externalDetails<>;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Details of AML Alert
struct AMLAlertDetails {
//: Comment on reason of AML Alert
string comment<>;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
struct ContractDetails {
longstring details;
// Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Details of a payment reviewable request
struct BillPayDetails {
//: Details of payment
PaymentOp paymentDetails;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Details of a request review
struct ReviewDetails {
//: Tasks to add to pending
uint32 tasksToAdd;
//: Tasks to remove from pending
uint32 tasksToRemove;
//: Details of the current review
string externalDetails<>;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Extended result of the review request operation containing details specific to a Create Sale Request
struct SaleExtended {
//: ID of the newly created sale as a result of Create Sale Request successful review
uint64 saleID;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Extended result of the review request operation containing details specific to a Create Atomic Swap Bid Request
struct AtomicSwapAskExtended
{
//: ID of the newly created ask as a result of Create Atomic Swap Ask Request successful review
uint64 askID;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Extended result of the review request operation containing details specific to a `CREATE_POLL` request
struct CreatePollExtended
{
//: ID of the newly created poll
uint64 pollID;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Extended result of a review request operation containing details specific to a Create Atomic Swap Request
struct AtomicSwapBidExtended
{
//: ID of a ask to apply atomic swap to
uint64 askID;
//: AccountID of a ask owner
AccountID askOwnerID;
//: Account id of an bid owner
AccountID bidOwnerID;
//: Base asset for the atomic swap
AssetCode baseAsset;
//: Quote asset for the atomic swap
AssetCode quoteAsset;
//: Amount in base asset to exchange
uint64 baseAmount;
//: Amount in quote asset to exchange
uint64 quoteAmount;
//: Price of base asset in terms of quote
uint64 price;
//: Balance in base asset of a ask owner
BalanceID askOwnerBaseBalanceID;
//: Balance in base asset of an bid owner
BalanceID bidOwnerBaseBalanceID;
//: Amount which was unlocked on bid owner base balance after bid removing
uint64 unlockedAmount;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
struct CreateDeferredPaymentResult
{
uint64 deferredPaymentID;
AccountID destination;
AccountID source;
EmptyExt ext;
};
struct DataCreationExtended {
//: Owner of the created data entry
AccountID owner;
//: ID of the created data entry
uint64 id;
//: Security type of the created data entry
uint64 type;
};
//: Extended result of a Review Request operation containing details specific to certain request types
struct ExtendedResult {
//: Indicates whether or not the request that is being reviewed was applied
bool fulfilled;
//: typeExt is used to pass ReviewableRequestType along with details specific to a request type
union switch(ReviewableRequestType requestType) {
case CREATE_SALE:
SaleExtended saleExtended;
case NONE:
void;
case CREATE_ATOMIC_SWAP_BID:
AtomicSwapBidExtended atomicSwapBidExtended;
case CREATE_ATOMIC_SWAP_ASK:
AtomicSwapAskExtended atomicSwapAskExtended;
case CREATE_POLL:
CreatePollExtended createPoll;
case MANAGE_OFFER:
ManageOfferResult manageOfferResult;
case CREATE_PAYMENT:
PaymentResult paymentResult;
case PERFORM_REDEMPTION:
CreateRedemptionRequestResult createRedemptionResult;
case DATA_CREATION:
DataCreationExtended dataCreationExtended;
case CREATE_DEFERRED_PAYMENT:
CreateDeferredPaymentResult createDeferredPaymentResult;
case CLOSE_DEFERRED_PAYMENT:
CloseDeferredPaymentResult closeDeferredPaymentResult;
} typeExt;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Review Request operation
struct ReviewRequestOp
{
//: ID of a request that is being reviewed
uint64 requestID;
//: Hash of a request that is being reviewed
Hash requestHash;
//: requestDetails is used to pass request type along with details specific to it.
union switch(ReviewableRequestType requestType) {
case CREATE_WITHDRAW:
WithdrawalDetails withdrawal;
case UPDATE_LIMITS:
LimitsUpdateDetails limitsUpdate;
case CREATE_AML_ALERT:
AMLAlertDetails amlAlertDetails;
case CREATE_INVOICE:
BillPayDetails billPay;
case MANAGE_CONTRACT:
ContractDetails contract;
default:
void;
} requestDetails;
//: Review action defines an action performed on the pending ReviewableRequest
ReviewRequestOpAction action;
//: Contains reject reason
longstring reason;
//: Details of the ReviewRequest operation
ReviewDetails reviewDetails;
//: Reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
/******* ReviewRequest Result ********/
//: Result code of the ReviewRequest operation
enum ReviewRequestResultCode
{
//: Codes considered as "success" for an operation
//: Operation is applied successfully
SUCCESS = 0,
//: Codes considered as "failure" for an operation
//: Reject reason must be empty on approve and not empty on reject/permanent
INVALID_REASON = -1,
//: Unknown action to perform on ReviewableRequest
INVALID_ACTION = -2,
//: Actual hash of the request and provided hash are mismatched
HASH_MISMATCHED = -3,
//: ReviewableRequest is not found
NOT_FOUND = -4,
//: Actual type of a reviewable request and provided type are mismatched
TYPE_MISMATCHED = -5,
//: Reject is not allowed. Only permanent reject should be used
REJECT_NOT_ALLOWED = -6,
//: External details must be a valid JSON
INVALID_EXTERNAL_DETAILS = -7,
//: Source of ReviewableRequest is blocked
REQUESTOR_IS_BLOCKED = -8,
//: Permanent reject is not allowed. Only reject should be used
PERMANENT_REJECT_NOT_ALLOWED = -9,
//: Trying to remove tasks which are not set
REMOVING_NOT_SET_TASKS = -100,// cannot remove tasks which are not set
//: Asset requests
//: Trying to create an asset that already exists
ASSET_ALREADY_EXISTS = -200,
//: Trying to update an asset that does not exist
ASSET_DOES_NOT_EXISTS = -210,
//: Issuance requests
//: After the issuance request application, issued amount will exceed max issuance amount
MAX_ISSUANCE_AMOUNT_EXCEEDED = -400,
//: Trying to issue more than it is available for issuance
INSUFFICIENT_AVAILABLE_FOR_ISSUANCE_AMOUNT = -410,
//: Funding account will exceed UINT64_MAX
FULL_LINE = -420,
//: It is not allowed to set system tasks
SYSTEM_TASKS_NOT_ALLOWED = -430,
//: Incorrect amount precision
INCORRECT_PRECISION = -440,
//: Sale creation requests
//: Trying to create a sale for a base asset that does not exist
BASE_ASSET_DOES_NOT_EXISTS = -500,
//: Trying to create a sale with hard cap that will exceed max issuance amount
HARD_CAP_WILL_EXCEED_MAX_ISSUANCE = -510,
//: Trying to create a sale with preissued amount that is less than the hard cap
INSUFFICIENT_PREISSUED_FOR_HARD_CAP = -520,
//: Trying to create a sale for a base asset that cannot be found
BASE_ASSET_NOT_FOUND = -530,
//: There is no asset pair between default quote asset and quote asset
ASSET_PAIR_NOT_FOUND = -540,
//: Trying to create a sale with one of the quote assets that doesn't exist
QUOTE_ASSET_NOT_FOUND = -550,
//: Change role
//: Trying to remove zero tasks
NON_ZERO_TASKS_TO_REMOVE_NOT_ALLOWED = -600,
//: There is no account role with provided id
ACCOUNT_ROLE_TO_SET_DOES_NOT_EXIST = -610,
//: Update sale details
//: Trying to update details of a non-existing sale
SALE_NOT_FOUND = -700,
//: Deprecated: Invoice requests
AMOUNT_MISMATCHED = -1010, // amount does not match
DESTINATION_BALANCE_MISMATCHED = -1020, // invoice balance and payment balance do not match
NOT_ALLOWED_ACCOUNT_DESTINATION = -1030,
REQUIRED_SOURCE_PAY_FOR_DESTINATION = -1040, // not allowed shift fee responsibility to destination
SOURCE_BALANCE_MISMATCHED = -1050, // source balance must match invoice sender account
CONTRACT_NOT_FOUND = -1060,
INVOICE_RECEIVER_BALANCE_LOCK_AMOUNT_OVERFLOW = -1070,
INVOICE_ALREADY_APPROVED = -1080,
// codes considered as "failure" for the payment operation
//: Deprecated: Invoice requests
PAYMENT_V2_MALFORMED = -1100,
UNDERFUNDED = -1110,
LINE_FULL = -1120,
DESTINATION_BALANCE_NOT_FOUND = -1130,
BALANCE_ASSETS_MISMATCHED = -1140,
SRC_BALANCE_NOT_FOUND = -1150,
REFERENCE_DUPLICATION = -1160,
STATS_OVERFLOW = -1170,
LIMITS_EXCEEDED = -1180,
NOT_ALLOWED_BY_ASSET_POLICY = -1190,
INVALID_DESTINATION_FEE = -1200,
INVALID_DESTINATION_FEE_ASSET = -1210, // destination fee asset must be the same as source balance asset
FEE_ASSET_MISMATCHED = -1220,
INSUFFICIENT_FEE_AMOUNT = -1230,
BALANCE_TO_CHARGE_FEE_FROM_NOT_FOUND = -1240,
PAYMENT_AMOUNT_IS_LESS_THAN_DEST_FEE = -1250,
DESTINATION_ACCOUNT_NOT_FOUND = -1260,
//: Limits update requests
//: Trying to create a limits update request for both account and account type at the same time
CANNOT_CREATE_FOR_ACC_ID_AND_ACC_TYPE = 1300,
//: Trying to set invalid limits, i.e. with dayly limit greater than weekly limit
INVALID_LIMITS = 1310,
//: There is no account with passed ID for limits update request
ACCOUNT_NOT_FOUND = -1311,
//: There is no role with passed ID for limits update request
ROLE_NOT_FOUND = -1312,
//: Deprecated: Contract requests
CONTRACT_DETAILS_TOO_LONG = -1400, // customer details reached length limit
// Atomic swap
BASE_ASSET_CANNOT_BE_SWAPPED = -1500,
QUOTE_ASSET_CANNOT_BE_SWAPPED = -1501,
ATOMIC_SWAP_BID_OWNER_FULL_LINE = -1504,
//KYC
//:Signer data is invalid - either weight is wrong or details are invalid
INVALID_SIGNER_DATA = -1600,
// offer
MANAGE_OFFER_FAILED = -1700,
// payment
PAYMENT_FAILED = -1800,
// Update Data
DATA_NOT_FOUND = -1900
};
//: Result of applying the review request with result code
union ReviewRequestResult switch (ReviewRequestResultCode code)
{
case SUCCESS:
ExtendedResult success;
case MANAGE_OFFER_FAILED:
ManageOfferResultCode manageOfferCode;
case PAYMENT_FAILED:
PaymentResultCode paymentCode;
default:
void;
};
}