Skip to main content

CommitInspect

Trait CommitInspect 

Source
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 Commitment traits and LazyBalance, ensuring consistent asset accounting across the commitment system.

Required Methods§

Source

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 model
  • Err(DispatchError) if the value cannot be determined
Source

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 digest
  • Err(DispatchError) if value cannot be retrieved
Source

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 entries
  • Err(DispatchError) if value cannot be calculated
Source

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 entry
  • Err(DispatchError) if value cannot be retrieved
Source

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 slots
  • Err(DispatchError) if value cannot be calculated
Source

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 slot
  • Err(DispatchError) if the slot does not exist or value cannot be retrieved
Source

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_model is provided, only values associated with that specific digest model are included
  • If digest_model is None, the total value across all relevant digests for the reason is returned
§Returns
  • Ok(Asset) containing the calculated total asset value
  • Err(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".

Implementors§