#![allow(unused_braces)] #![deny(
non_upper_case_globals,
non_camel_case_types,
non_snake_case,
unused_mut,
unused_imports,
dead_code,
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#[macro_use]
extern crate amplify;
#[macro_use]
extern crate strict_encoding;
#[macro_use]
extern crate commit_verify;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde_crate as serde;
extern crate core;
pub mod contract;
pub mod schema;
pub mod validation;
pub mod vm;
#[cfg(feature = "stl")]
pub mod stl;
pub mod prelude {
pub use bp::dbc::AnchorId;
pub use contract::*;
pub use schema::*;
use super::*;
pub use super::{schema, vm};
}
pub use prelude::*;
pub const LIB_NAME_RGB: &str = "RGB";
#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Default, Debug, Display)]
#[display("reserved")]
#[derive(StrictType, StrictEncode)]
#[strict_type(lib = LIB_NAME_RGB)]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate", rename_all = "camelCase")
)]
pub struct ReservedByte(u8);
mod _reserved {
use strict_encoding::{DecodeError, ReadTuple, StrictDecode, TypedRead};
use crate::ReservedByte;
impl StrictDecode for ReservedByte {
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError> {
let reserved = reader.read_tuple(|r| r.read_field().map(Self))?;
if reserved != ReservedByte::default() {
Err(DecodeError::DataIntegrityError(format!(
"unsupported reserved byte value indicating a future RGB version. Please \
update your software, or, if the problem persists, contact your vendor \
providing the following version information: {reserved}"
)))
} else {
Ok(reserved)
}
}
}
}
#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Default, Debug, Display)]
#[display("RGB/1.{0}")]
#[derive(StrictType, StrictEncode)]
#[strict_type(lib = LIB_NAME_RGB)]
#[derive(CommitEncode)]
#[commit_encode(strategy = strict)]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate", rename_all = "camelCase")
)]
pub struct Ffv(u16);
mod _ffv {
use strict_encoding::{DecodeError, ReadTuple, StrictDecode, TypedRead};
use crate::Ffv;
impl StrictDecode for Ffv {
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError> {
let ffv = reader.read_tuple(|r| r.read_field().map(Self))?;
if ffv != Ffv::default() {
Err(DecodeError::DataIntegrityError(format!(
"unsupported fast-forward version code belonging to a future RGB version. \
Please update your software, or, if the problem persists, contact your \
vendor providing the following version information: {ffv}"
)))
} else {
Ok(ffv)
}
}
}
}