2021-01-20 12:09:09 -08:00
|
|
|
//! Monetary values within the Orchard shielded pool.
|
|
|
|
//!
|
|
|
|
//! Values are represented in two places within Orchard:
|
|
|
|
//! - The value of an individual note, which is unsigned.
|
|
|
|
//! - The sum of note values within an Orchard [`Action`] or [`Bundle`], which is signed.
|
|
|
|
//!
|
|
|
|
//! We give these separate types within this crate. Users should map these types to their
|
|
|
|
//! own general "amount" type as appropriate.
|
|
|
|
//!
|
|
|
|
//! Inside the circuit, values are constrained to be 63-bit integers.
|
|
|
|
//! - TODO: Should this be constrained further to 53 bits? To Zcash's MAX_MONEY?
|
|
|
|
//!
|
|
|
|
//! [`Action`]: crate::bundle::Action
|
|
|
|
//! [`Bundle`]: crate::bundle::Bundle
|
|
|
|
|
|
|
|
/// The value of an individual Orchard note.
|
|
|
|
#[derive(Debug)]
|
2021-01-21 04:16:50 -08:00
|
|
|
pub struct NoteValue(u64);
|
2021-01-20 12:09:09 -08:00
|
|
|
|
|
|
|
/// A sum of Orchard note values.
|
|
|
|
#[derive(Debug)]
|
2021-01-21 04:16:50 -08:00
|
|
|
pub struct ValueSum(i64);
|
2021-01-20 12:09:09 -08:00
|
|
|
|
|
|
|
/// A commitment to a [`ValueSum`].
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct ValueCommitment;
|