/
Stellar-operation-manage-asset-pair.x
85 lines (67 loc) · 1.7 KB
/
Stellar-operation-manage-asset-pair.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
// 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"
namespace stellar
{
enum ManageAssetPairAction
{
CREATE = 0,
UPDATE_PRICE = 1,
UPDATE_POLICIES = 2
};
/* ManageAssetPairOp
Creates or updates asset pair
Threshold: high
Result: ManageAssetPairResult
*/
struct ManageAssetPairOp
{
ManageAssetPairAction action;
AssetCode base;
AssetCode quote;
int64 physicalPrice;
int64 physicalPriceCorrection; // correction of physical price in percents. If physical price is set and restriction by physical price set, mininal price for offer for this pair will be physicalPrice * physicalPriceCorrection
int64 maxPriceStep;
int32 policies;
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
/******* ManageAsset Result ********/
enum ManageAssetPairResultCode
{
// codes considered as "success" for the operation
SUCCESS = 0,
// codes considered as "failure" for the operation
NOT_FOUND = -1, // failed to find asset with such code
ALREADY_EXISTS = -2,
MALFORMED = -3,
INVALID_ASSET = -4,
INVALID_ACTION = -5,
INVALID_POLICIES = -6,
ASSET_NOT_FOUND = -7
};
struct ManageAssetPairSuccess
{
int64 currentPrice;
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
union ManageAssetPairResult switch (ManageAssetPairResultCode code)
{
case SUCCESS:
ManageAssetPairSuccess success;
default:
void;
};
}