rgbstd/lib.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#![deny(
23 non_upper_case_globals,
24 non_camel_case_types,
25 non_snake_case,
26 unused_mut,
27 unused_imports,
28 dead_code,
29 // missing_docs
30)]
31#![cfg_attr(docsrs, feature(doc_auto_cfg))]
32
33// CORE LIB:
34// issue :: Schema, Metadata, {GlobalState}, {Assignments} -> Genesis
35//
36// STD LIB:
37// import :: Stash, (Schema | Interface) -> Stash
38// state :: Inventory, ContractId -> ContractState
39// interpret :: ContractState, Interface -> InterpretedState
40//
41// issue :: Schema, State, Interface -> Consignment -- calls `core::issue`
42// -- internally
43// extract :: Inventory, ContractId, Interface -> Consignment
44// -- contract transfer
45//
46// compose :: Inventory, ContractId, Interface, [Outpoint] -> Consignment
47// -- base for state transfer describing existing state
48// transfer :: Consignment, (...) -> StateTransition -- prepares transition
49// preserve :: Stash, [Outpoint], StateTransition -> [StateTransition]
50// -- creates blank state transitions
51// consign :: Stash, StateTransition -> Consignment -- extracts history data
52//
53// reveal :: Consignment, RevealInfo -> Consignment -- removes blinding from
54// -- known UTXOs
55// validate :: Consignment -> (Validity, ContractUpdate)
56// enclose :: Inventory, Disclosure -> Inventory !!
57// consume :: Inventory, Consignment -> Inventory !! -- for both transfers and
58// -- contracts
59//
60// endpoints :: Consignment -> [Outpoint] -- used to construct initial PSBT
61
62// WALLET LIB:
63// embed :: Psbt, ContractId -> Psbt -- adds contract information to PSBT
64// commit :: Psbt, ContractId, Transition -> Psbt -- adds transition
65// -- information to the PSBT
66// bundle :: Psbt -> Psbt -- takes individual transitions and bundles them
67// finalize :: Psbt -> Psbt -- should be performed by BP; converts individual
68// -- commitments into tapret
69
70extern crate core;
71#[macro_use]
72extern crate amplify;
73#[macro_use]
74extern crate strict_encoding;
75#[cfg(feature = "serde")]
76#[macro_use]
77extern crate serde_crate as serde;
78
79pub use rgb::{contract, schema, validation, vm};
80
81pub mod stl;
82pub mod interface;
83pub mod containers;
84pub mod persistence;
85pub mod resolvers;
86pub mod accessors;
87mod reserved;
88
89pub use bp::{Chain, Outpoint, Txid};
90use reserved::ReservedBytes;
91pub use stl::{LIB_NAME_RGB_CONTRACT, LIB_NAME_RGB_STD};