Skip to main content

xrpl_wasm_stdlib/core/ledger_objects/
escrow.rs

1use crate::core::ledger_objects::traits::{EscrowFields, LedgerObjectCommonFields};
2
3#[derive(Debug, Clone, Copy, Eq, PartialEq)]
4#[repr(C)]
5pub struct Escrow {
6    pub(crate) slot_num: i32,
7}
8
9impl LedgerObjectCommonFields for Escrow {
10    fn get_slot_num(&self) -> i32 {
11        self.slot_num
12    }
13}
14
15impl EscrowFields for Escrow {}
16
17impl Escrow {
18    pub fn new(slot_num: i32) -> Self {
19        Self { slot_num }
20    }
21}
22
23#[cfg(test)]
24mod tests {
25    use super::*;
26
27    #[test]
28    fn test_new() {
29        let escrow = Escrow::new(42);
30        assert_eq!(escrow.slot_num, 42);
31    }
32}