/
Stellar-operation-manage-balance.x
75 lines (60 loc) · 1.49 KB
/
Stellar-operation-manage-balance.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
// 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
{
/* ManageBalance
Threshold: med
Result: ManageBalanceResult
*/
enum ManageBalanceAction
{
CREATE = 0,
DELETE_BALANCE = 1,
CREATE_UNIQUE = 2 // ensures that balance will not be created if one for such asset and account exists
};
struct ManageBalanceOp
{
ManageBalanceAction action;
AccountID destination;
AssetCode asset;
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
/******* ManageBalance Result ********/
enum ManageBalanceResultCode
{
// codes considered as "success" for the operation
SUCCESS = 0,
// codes considered as "failure" for the operation
MALFORMED = -1, // invalid destination
NOT_FOUND = -2,
DESTINATION_NOT_FOUND = -3,
ASSET_NOT_FOUND = -4,
INVALID_ASSET = -5,
BALANCE_ALREADY_EXISTS = -6,
VERSION_IS_NOT_SUPPORTED_YET = -7 // version specified in request is not supported yet
};
struct ManageBalanceSuccess {
BalanceID balanceID;
// reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
union ManageBalanceResult switch (ManageBalanceResultCode code)
{
case SUCCESS:
ManageBalanceSuccess success;
default:
void;
};
}