rgbstd/persistence/
mod.rs

1// RGB standard library for working with smart contracts on Bitcoin & Lightning
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Written in 2019-2023 by
6//     Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
7//
8// Copyright (C) 2019-2023 LNP/BP Standards Association. All rights reserved.
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14//     http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21
22//! Module defines API used by providers of persistent data for RGB contracts.
23//!
24//! These data include:
25//! 1. [`Stash`]: a consensus-critical data for client-side-validation which
26//!    must be preserved and backed up.
27//! 2. [`rgb::ContractState`], updated with each enclosed consignment and
28//!    disclosure.
29//! 3. Index over stash, which simplifies construction of a new consignments.
30//! 4. [`Inventory`], which abstracts stash, contract states and index for
31//!    complex operations requiring participation of all of them.
32//!
33//! 2-4 data can be re-computed from the stash in case of loss or corruption.
34
35mod stash;
36mod inventory;
37pub mod stock;
38pub mod hoard;
39
40pub use hoard::Hoard;
41pub use inventory::{
42    ConsignerError, Inventory, InventoryDataError, InventoryError, InventoryInconsistency,
43};
44pub use stash::{Stash, StashError, StashInconsistency};
45pub use stock::Stock;