Skip to main content

bee_ledger_types/
treasury_diff.rs

1// Copyright 2020-2021 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use bee_block::payload::milestone::MilestoneId;
5
6/// Wraps together the identifiers of the milestones that created and consumed treasury outputs.
7#[derive(Clone, Debug, Eq, PartialEq, packable::Packable)]
8pub struct TreasuryDiff {
9    created: MilestoneId,
10    consumed: MilestoneId,
11}
12
13impl TreasuryDiff {
14    /// Creates a new `TreasuryDiff`.
15    pub fn new(created: MilestoneId, consumed: MilestoneId) -> Self {
16        Self { created, consumed }
17    }
18
19    /// Returns the id of the milestone that created the treasury output associated to the `TreasuryDiff`.
20    pub fn created(&self) -> &MilestoneId {
21        &self.created
22    }
23
24    /// Returns the id of the milestone that consumed the treasury input associated to the `TreasuryDiff`.
25    pub fn consumed(&self) -> &MilestoneId {
26        &self.consumed
27    }
28}