Trait CommitDeposit

Source
pub trait CommitDeposit<Proprietor, Pallet>
where Pallet: LazyBalance<Asset = <Pallet as InspectAsset<Proprietor>>::Asset, Variant = Pallet::Position, Id = Pallet::Digest> + DigestModel<Proprietor> + CommitVariant<Proprietor>,
{ type Receipt; // Required methods fn deposit_to( who: &Proprietor, reason: &Pallet::Reason, digest_model: &Pallet::Model, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>; fn deposit_to_digest( who: &Proprietor, reason: &Pallet::Reason, digest: &Pallet::Digest, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>; fn deposit_to_index( who: &Proprietor, reason: &Pallet::Reason, index_of: &Pallet::Digest, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>; fn deposit_to_pool( who: &Proprietor, reason: &Pallet::Reason, pool_of: &Pallet::Digest, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>; }
Expand description

Provides low-level deposit operations for commitment systems, enabling assets to be recorded against digests, indexes, and pools for a given proprietor.

This trait focuses solely on recording deposits within the system. It does not handle balance deductions, freezing funds, or higher-level commit management - those responsibilities are delegated to upper layers of the Commitment framework.

It only 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 Associated Types§

Source

type Receipt

Type representing a “Receipt” of the deposit towards the digest (direct) at the time of commitment.

A receipt acts as a claimable bill over the digest’s balance, capturing the state at the time of commitment. This allows commitments to be resolved accurately later, even if the underlying balance changes.

Effectively serves as a versioned claim tied to a specific commitment.

Required Methods§

Source

fn deposit_to( who: &Proprietor, reason: &Pallet::Reason, digest_model: &Pallet::Model, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>

Deposits a value to a fully resolved/wrapped digest model and it’s specified balance variant.

This function assumes the digest has already been resolved and wrapped appropriately, so it directly handles the act of only depositing the given value under the specified reason.

This is a low-level function that only records the deposit to the digest model. It does not perform balance deductions or handle commit-level operations such as freezing funds or storing commitment records. Any such logic must be handled at a higher level.

Some digests such as indexes and pools may not require a variant, yet direct requires it, so its kept reagrdless and the caller must acknowledge that.

§Returns
  • Ok((Receipt, Asset)) containing the deposit’s state and the actual deposit value.
  • Err(DispatchError) if the deposit fails
Source

fn deposit_to_digest( who: &Proprietor, reason: &Pallet::Reason, digest: &Pallet::Digest, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>

Deposits a committed asset into a given digest of variant for a specified reason.

This is a low-level function that only records the deposit to the digest. It does not perform balance deductions or handle commit-level operations such as freezing funds or storing commitment records. Any such logic must be handled at a higher level.

§Returns
  • Ok((Receipt, Asset)) containing the deposit’s state and the actual deposit value.
  • Err(DispatchError) if the deposit fails
Source

fn deposit_to_index( who: &Proprietor, reason: &Pallet::Reason, index_of: &Pallet::Digest, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>

Deposits a committed asset into a given index for a specified reason.

This is a low-level function that only records the deposit to the index. It does not perform balance deductions or handle commit-level operations such as freezing funds or storing commitment records.
Any such logic must be handled at a higher level.

§Returns
  • Ok((Receipt, Asset)) containing the deposit’s state and the actual deposit value.
  • Err(DispatchError) if the deposit fails
Source

fn deposit_to_pool( who: &Proprietor, reason: &Pallet::Reason, pool_of: &Pallet::Digest, value: <Pallet as InspectAsset<Proprietor>>::Asset, variant: &Pallet::Position, qualifier: &Pallet::Intent, ) -> Result<(Self::Receipt, <Pallet as InspectAsset<Proprietor>>::Asset), DispatchError>

Deposits a committed asset into a given pool of a variant for a specified reason.

This is a low-level function that only records the deposit to the pool. It does not perform balance deductions or handle commit-level operations such as freezing funds or storing commitment records.
Any such logic must be handled at a higher level.

§Returns
  • Ok((Receipt, Asset)) containing the deposit’s state and the actual deposit value.
  • Err(DispatchError) if the deposit fails

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§

Source§

impl<T: Config<I>, I: 'static> CommitDeposit<<T as Config>::AccountId, Pallet<T, I>> for CommitHelpers<T, I>

Implements the CommitDeposit trait for the pallet, providing low-level deposit functionality for digests, indexes, and pools within the commitment system.