This repository was archived by the owner on Feb 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathOfferEntry.cs
89 lines (84 loc) · 2.94 KB
/
OfferEntry.cs
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
// Automatically generated by xdrgen
// DO NOT EDIT or your changes may be overwritten
namespace Stellar.Generated
{
// === xdr source ============================================================
// struct OfferEntry
// {
// AccountID sellerID;
// uint64 offerID;
// Asset selling; // A
// Asset buying; // B
// int64 amount; // amount of A
//
// /* price for this offer:
// price of A in terms of B
// price=AmountB/AmountA=priceNumerator/priceDenominator
// price is after fees
// */
// Price price;
// uint32 flags; // see OfferEntryFlags
//
// // reserved for future use
// union switch (int v)
// {
// case 0:
// void;
// }
// ext;
// };
// ===========================================================================
public class OfferEntry {
public OfferEntry () {}
public AccountID SellerID { get; set; }
public Uint64 OfferID { get; set; }
public Asset Selling { get; set; }
public Asset Buying { get; set; }
public Int64 Amount { get; set; }
public Price Price { get; set; }
public Uint32 Flags { get; set; }
public OfferEntryExt Ext { get; set; }
public static void Encode(IByteWriter stream, OfferEntry encodedOfferEntry) {
AccountID.Encode(stream, encodedOfferEntry.SellerID);
Uint64.Encode(stream, encodedOfferEntry.OfferID);
Asset.Encode(stream, encodedOfferEntry.Selling);
Asset.Encode(stream, encodedOfferEntry.Buying);
Int64.Encode(stream, encodedOfferEntry.Amount);
Price.Encode(stream, encodedOfferEntry.Price);
Uint32.Encode(stream, encodedOfferEntry.Flags);
OfferEntryExt.Encode(stream, encodedOfferEntry.Ext);
}
public static OfferEntry Decode(IByteReader stream) {
OfferEntry decodedOfferEntry = new OfferEntry();
decodedOfferEntry.SellerID = AccountID.Decode(stream);
decodedOfferEntry.OfferID = Uint64.Decode(stream);
decodedOfferEntry.Selling = Asset.Decode(stream);
decodedOfferEntry.Buying = Asset.Decode(stream);
decodedOfferEntry.Amount = Int64.Decode(stream);
decodedOfferEntry.Price = Price.Decode(stream);
decodedOfferEntry.Flags = Uint32.Decode(stream);
decodedOfferEntry.Ext = OfferEntryExt.Decode(stream);
return decodedOfferEntry;
}
public class OfferEntryExt {
public OfferEntryExt () {}
public int Discriminant { get; set; } = new int();
public static void Encode(IByteWriter stream, OfferEntryExt encodedOfferEntryExt) {
XdrEncoding.EncodeInt32(encodedOfferEntryExt.Discriminant, stream);
switch (encodedOfferEntryExt.Discriminant) {
case 0:
break;
}
}
public static OfferEntryExt Decode(IByteReader stream) {
OfferEntryExt decodedOfferEntryExt = new OfferEntryExt();
decodedOfferEntryExt.Discriminant = XdrEncoding.DecodeInt32(stream);
switch (decodedOfferEntryExt.Discriminant) {
case 0:
break;
}
return decodedOfferEntryExt;
}
}
}
}