bee_ledger/types/
migration.rs

1// Copyright 2020-2021 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::types::{Receipt, TreasuryOutput};
5
6/// A type to tie together the receipt, consumed treasury and created treasury of a migration.
7pub struct Migration {
8    receipt: Receipt,
9    consumed_treasury: TreasuryOutput,
10    created_treasury: TreasuryOutput,
11}
12
13impl Migration {
14    /// Creates a new `Migration`.
15    pub fn new(receipt: Receipt, consumed_treasury: TreasuryOutput, created_treasury: TreasuryOutput) -> Self {
16        Self {
17            receipt,
18            consumed_treasury,
19            created_treasury,
20        }
21    }
22
23    /// Returns the receipt of the `Migration`.
24    pub fn receipt(&self) -> &Receipt {
25        &self.receipt
26    }
27
28    /// Returns the consumed treasury output of the `Migration`.
29    pub fn consumed_treasury(&self) -> &TreasuryOutput {
30        &self.consumed_treasury
31    }
32
33    /// Returns the created treasury output of the `Migration`.
34    pub fn created_treasury(&self) -> &TreasuryOutput {
35        &self.created_treasury
36    }
37}