pub trait CommitInspect<Proprietor, Pallet>where
Pallet: LazyBalance<Asset = <Pallet as InspectAsset<Proprietor>>::Asset, Id = Pallet::Digest> + DigestModel<Proprietor> + Commitment<Proprietor>,{
// Required methods
fn commit_value_of(
who: &Proprietor,
reason: &Pallet::Reason,
digest_model: &Pallet::Model,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>;
fn digest_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
digest: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>;
fn index_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>;
fn index_entry_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
entry_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>;
fn pool_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
pool_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>;
fn pool_slot_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
pool_of: &Pallet::Digest,
slot_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>;
fn value_of(
digest_model: Option<&Pallet::Model>,
reason: &Pallet::Reason,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>;
}Expand description
Provides inspection and querying capabilities for committed values across digests, indexes, and pools for a given proprietor.
This trait allows retrieving real-time committed values without altering state, supporting precise accounting and auditability.
This trait defines low-level, unchecked operations - callers are responsible for ensuring validity and equilibrium before invoking these functions.
§Generics
- Proprietor - the entity (e.g. account, vault, or manager) controlling the asset.
- Pallet - the public struct implementing
Commitmenttraits andLazyBalance, ensuring consistent asset accounting across the commitment system.
Required Methods§
Sourcefn commit_value_of(
who: &Proprietor,
reason: &Pallet::Reason,
digest_model: &Pallet::Model,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
fn commit_value_of( who: &Proprietor, reason: &Pallet::Reason, digest_model: &Pallet::Model, ) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
Retrieves the real-time commitment value for a fully resolved digest model.
Aggregates all individual commit instances associated with the digest model for the given proprietor and reason, returning a single live value.
§Returns
Ok(Asset)containing the total committed value for the digest modelErr(DispatchError)if the value cannot be determined
Sourcefn digest_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
digest: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
fn digest_commit_value( who: &Proprietor, reason: &Pallet::Reason, digest: &Pallet::Digest, ) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
Retrieves the real-time commitment value for a direct digest.
Returns the total value proprietor commit holds under the given reason for the direct digest.
§Returns
Ok(Asset)containing the committed value for the digestErr(DispatchError)if value cannot be retrieved
Sourcefn index_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
fn index_commit_value( who: &Proprietor, reason: &Pallet::Reason, index_of: &Pallet::Digest, ) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
Retrieves the real-time commitment value for an index digest.
Computes the aggregate value across all entries contained in the index for the specified proprietor and reason.
§Returns
Ok(Asset)containing the total committed value across all index entriesErr(DispatchError)if value cannot be calculated
Sourcefn index_entry_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
entry_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
fn index_entry_commit_value( who: &Proprietor, reason: &Pallet::Reason, index_of: &Pallet::Digest, entry_of: &Pallet::Digest, ) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
Retrieves the real-time commitment value for a specific entry within an index.
Provides the real-time value for a single entry digest within the index, reflecting the proprietor’s commitment to that specific entry.
§Returns
Ok(Asset)containing the committed value for the entryErr(DispatchError)if value cannot be retrieved
Sourcefn pool_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
pool_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
fn pool_commit_value( who: &Proprietor, reason: &Pallet::Reason, pool_of: &Pallet::Digest, ) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
Retrieves the real-time commitment value for a pool digest.
Aggregates the values of all slots under the pool for the proprietor.
§Returns
Ok(Asset)containing the total committed value across all pool slotsErr(DispatchError)if value cannot be calculated
Sourcefn pool_slot_commit_value(
who: &Proprietor,
reason: &Pallet::Reason,
pool_of: &Pallet::Digest,
slot_of: &Pallet::Digest,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
fn pool_slot_commit_value( who: &Proprietor, reason: &Pallet::Reason, pool_of: &Pallet::Digest, slot_of: &Pallet::Digest, ) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
Retrieves the committed value of a specific slot for a particular proprietor.
Aggregates the proprietor’s commitment to that slot within the pool in real-time, showing their individual exposure to the slot.
§Returns
Ok(Asset)containing the proprietor’s committed value for the slotErr(DispatchError)if the slot does not exist or value cannot be retrieved
Sourcefn value_of(
digest_model: Option<&Pallet::Model>,
reason: &Pallet::Reason,
) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
fn value_of( digest_model: Option<&Pallet::Model>, reason: &Pallet::Reason, ) -> Result<<Pallet as InspectAsset<Proprietor>>::Asset, DispatchError>
Queries the real-time value of commitments for a given reason.
This function calculates the current committed value based on the provided parameters:
- If
digest_modelis provided, only values associated with that specific digest model are included - If
digest_modelisNone, the total value across all relevant digests for the reason is returned
§Returns
Ok(Asset)containing the calculated total asset valueErr(DispatchError)if the query fails or the value cannot be determined
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<T: Config<I>, I: 'static> CommitInspect<<T as Config>::AccountId, Pallet<T, I>> for CommitHelpers<T, I>
Implements the CommitInspect trait for the pallet, providing low-level
inspection and querying capabilities for committed values across digests,
indexes, and pools.
This implementation allows retrieving real-time committed values without altering state, supporting precise accounting and auditability. All functions are low-level and unchecked, meaning callers are responsible for ensuring correctness and invariants before invoking.