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
use resources::{Amount, AssetIdentifier};

/// Use “Change Trust” operation to create/update/delete a trust line from the source account to
/// another. The issuer being trusted and the asset code are in the given Asset object.
#[derive(Debug, Clone)]
pub struct ChangeTrust {
    trustee: String,
    trustor: String,
    asset: AssetIdentifier,
    limit: Amount,
}

impl ChangeTrust {
    /// Creates a new ChangeTrust
    pub fn new(
        trustee: String,
        trustor: String,
        asset: AssetIdentifier,
        limit: Amount,
    ) -> ChangeTrust {
        ChangeTrust {
            trustee,
            trustor,
            asset,
            limit,
        }
    }

    /// Trustee account.
    pub fn trustee(&self) -> &str {
        &self.trustee
    }

    /// Trustor account.
    pub fn trustor(&self) -> &str {
        &self.trustor
    }

    /// Asset being trusted.
    pub fn asset(&self) -> &AssetIdentifier {
        &self.asset
    }

    /// The limit for the asset.
    pub fn limit(&self) -> Amount {
        self.limit
    }
}