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
use resources::{Amount, AssetIdentifier};
#[derive(Debug, Deserialize, Clone)]
pub enum Kind {
Trade(Trade),
}
#[derive(Debug, Deserialize, Clone)]
pub struct Trade {
account: String,
offer_id: i64,
seller: String,
sold_amount: Amount,
sold_asset: AssetIdentifier,
bought_amount: Amount,
bought_asset: AssetIdentifier,
}
impl Trade {
pub fn new(
account: String,
offer_id: i64,
seller: String,
sold_amount: Amount,
sold_asset: AssetIdentifier,
bought_amount: Amount,
bought_asset: AssetIdentifier,
) -> Trade {
Trade {
account,
offer_id,
seller,
sold_amount,
sold_asset,
bought_amount,
bought_asset,
}
}
pub fn account(&self) -> &String {
&self.account
}
pub fn offer_id(&self) -> i64 {
self.offer_id
}
pub fn seller(&self) -> &String {
&self.seller
}
pub fn sold_amount(&self) -> Amount {
self.sold_amount
}
pub fn sold_asset(&self) -> &AssetIdentifier {
&self.sold_asset
}
pub fn bought_amount(&self) -> Amount {
self.bought_amount
}
pub fn bought_asset(&self) -> &AssetIdentifier {
&self.bought_asset
}
}