pub trait CommitWithdraw<Proprietor, Pallet>: CommitBalance<Proprietor, Pallet>where
Pallet: LazyBalance<Asset = <Pallet as InspectAsset<Proprietor>>::Asset, Variant = Pallet::Position, Id = Pallet::Digest> + DigestModel<Proprietor> + CommitVariant<Proprietor>,{
// Required methods
fn withdraw_for(
who: &Proprietor,
reason: &Pallet::Reason,
digest_model: &Pallet::Model,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>;
fn withdraw_from_digest(
who: &Proprietor,
reason: &Pallet::Reason,
digest: &Pallet::Digest,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>;
fn withdraw_from_index(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>;
fn withdraw_from_pool(
who: &Proprietor,
reason: &Pallet::Reason,
pool_of: &Pallet::Digest,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>;
}Expand description
Provides low-level withdrawal operations for commitment systems, enabling proprietors to extract committed assets from digests, indexes, and pools for a given reason.
This trait focuses solely on withdrawing committed values. It does not
handle higher-level operations such as unfreezing funds, updating commitment records,
or enforcing variant rules - 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
Commitmenttraits andLazyBalance, ensuring consistent asset accounting across the commitment system.
Required Methods§
Sourcefn withdraw_for(
who: &Proprietor,
reason: &Pallet::Reason,
digest_model: &Pallet::Model,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>
fn withdraw_for( who: &Proprietor, reason: &Pallet::Reason, digest_model: &Pallet::Model, variant: &Pallet::Position, ) -> Result<Self::Imbalance, DispatchError>
Withdraws the proprietor’s value of a commitment done to a resolved/wrapped digest model for a given reason.
This function assumes the digest has already been resolved and wrapped appropriately, so it directly handles the act of only withdrawing its total committed value under the specified reason.
This is a low-level function that only withdraws to the given proprietor.
It does not perform commit-level operations such as unfreezing funds or
updating commitment records, nor variant validation.
Any such logic must be handled at a higher level.
§Returns
Ok(Imbalance)containing the withdrawal imbalanceErr(DispatchError)if the withdrawal fails
Sourcefn withdraw_from_digest(
who: &Proprietor,
reason: &Pallet::Reason,
digest: &Pallet::Digest,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>
fn withdraw_from_digest( who: &Proprietor, reason: &Pallet::Reason, digest: &Pallet::Digest, variant: &Pallet::Position, ) -> Result<Self::Imbalance, DispatchError>
Withdraws the proprietor’s value of a commitment to the given digest of variant for a specified reason.
This is a low-level function that only withdraws to the given proprietor.
It does not perform commit-level operations such as unfreezing funds or
updating commitment records.
Any such logic must be handled at a higher level.
§Returns
Ok(Imbalance)containing the withdrawal imbalanceErr(DispatchError)if the withdrawal fails
Sourcefn withdraw_from_index(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>
fn withdraw_from_index( who: &Proprietor, reason: &Pallet::Reason, index_of: &Pallet::Digest, variant: &Pallet::Position, ) -> Result<Self::Imbalance, DispatchError>
Withdraws the proprietor’s value of a commitment to the given index digest of variant for a specified reason.
This is a low-level function that only withdraws to the given proprietor.
It does not perform commit-level operations such as unfreezing funds or
updating commitment records.
Any such logic must be handled at a higher level.
§Returns
Ok(Imbalance)containing the withdrawal imbalanceErr(DispatchError)if the withdrawal fails
Sourcefn withdraw_from_pool(
who: &Proprietor,
reason: &Pallet::Reason,
pool_of: &Pallet::Digest,
variant: &Pallet::Position,
) -> Result<Self::Imbalance, DispatchError>
fn withdraw_from_pool( who: &Proprietor, reason: &Pallet::Reason, pool_of: &Pallet::Digest, variant: &Pallet::Position, ) -> Result<Self::Imbalance, DispatchError>
Withdraws the proprietor’s value of a commitment to the given pool digest of variant for a specified reason.
This is a low-level function that only withdraws to the given proprietor.
It does not perform commit-level operations such as unfreezing funds or
updating commitment records.
Any such logic must be handled at a higher level.
§Returns
Ok(Imbalance)containing the withdrawal imbalanceErr(DispatchError)if the withdrawal 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§
impl<T: Config<I>, I: 'static> CommitWithdraw<<T as Config>::AccountId, Pallet<T, I>> for CommitHelpers<T, I>
Implements the CommitWithdraw trait for the pallet
Provides low-level withdraw functionality for digests, indexes, and pools within the commitment system.