pub enum BalanceOp<T: LazyBalanceMarker, M: ManualBalanceModel<T>> {
Deposit(M::User, T::Asset, T::Subject),
Withdraw(M::User),
Mint(T::Asset, T::Subject),
Reap(T::Asset, T::Subject),
Drain,
}Expand description
Operation descriptor for driving both LazyBalance and
ManualBalanceModel executions in a consistent manner.
Each variant represents a high-level balance action along with the required inputs. These operations are typically used in testing or simulation to:
- execute the lazy balance model
- pass the resolved results into a manual (eager) model
- compare and validate behavior across both systems
Variants§
Deposit(M::User, T::Asset, T::Subject)
Deposit operation.
(user, amount, subject) where:
useris the target accountamountis the requested asset valuesubjectdefines execution intent (e.g., precision/behavior)
Withdraw(M::User)
Withdraw operation.
(user) where:
useris the account performing withdrawal
Mint(T::Asset, T::Subject)
Mint operation.
(amount, subject) where:
amountis the asset value to introducesubjectdefines execution intent
Reap(T::Asset, T::Subject)
Reap operation.
(amount, subject) where:
amountis the asset value to remove or adjustsubjectdefines execution intent
Drain
Drain (Full-Reap) operation.
Resets the entire balance state.
Trait Implementations§
Source§impl<T: Clone + LazyBalanceMarker, M: Clone + ManualBalanceModel<T>> Clone for BalanceOp<T, M>
impl<T: Clone + LazyBalanceMarker, M: Clone + ManualBalanceModel<T>> Clone for BalanceOp<T, M>
Source§impl<T: Debug + LazyBalanceMarker, M: Debug + ManualBalanceModel<T>> Debug for BalanceOp<T, M>
impl<T: Debug + LazyBalanceMarker, M: Debug + ManualBalanceModel<T>> Debug for BalanceOp<T, M>
Source§impl<T: Ord + LazyBalanceMarker, M: Ord + ManualBalanceModel<T>> Ord for BalanceOp<T, M>
impl<T: Ord + LazyBalanceMarker, M: Ord + ManualBalanceModel<T>> Ord for BalanceOp<T, M>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialEq + LazyBalanceMarker, M: PartialEq + ManualBalanceModel<T>> PartialEq for BalanceOp<T, M>
impl<T: PartialEq + LazyBalanceMarker, M: PartialEq + ManualBalanceModel<T>> PartialEq for BalanceOp<T, M>
Source§impl<T: PartialOrd + LazyBalanceMarker, M: PartialOrd + ManualBalanceModel<T>> PartialOrd for BalanceOp<T, M>
impl<T: PartialOrd + LazyBalanceMarker, M: PartialOrd + ManualBalanceModel<T>> PartialOrd for BalanceOp<T, M>
impl<T: Copy + LazyBalanceMarker, M: Copy + ManualBalanceModel<T>> Copy for BalanceOp<T, M>
impl<T: Eq + LazyBalanceMarker, M: Eq + ManualBalanceModel<T>> Eq for BalanceOp<T, M>
impl<T: LazyBalanceMarker, M: ManualBalanceModel<T>> StructuralPartialEq for BalanceOp<T, M>
Auto Trait Implementations§
impl<T, M> Freeze for BalanceOp<T, M>where
<M as ManualBalanceModel<T>>::User: Freeze,
<T as LazyBalance>::Asset: Freeze,
<T as LazyBalance>::Subject: Freeze,
impl<T, M> RefUnwindSafe for BalanceOp<T, M>where
<M as ManualBalanceModel<T>>::User: RefUnwindSafe,
<T as LazyBalance>::Asset: RefUnwindSafe,
<T as LazyBalance>::Subject: RefUnwindSafe,
impl<T, M> Send for BalanceOp<T, M>
impl<T, M> Sync for BalanceOp<T, M>
impl<T, M> Unpin for BalanceOp<T, M>where
<M as ManualBalanceModel<T>>::User: Unpin,
<T as LazyBalance>::Asset: Unpin,
<T as LazyBalance>::Subject: Unpin,
impl<T, M> UnwindSafe for BalanceOp<T, M>where
<M as ManualBalanceModel<T>>::User: UnwindSafe,
<T as LazyBalance>::Asset: UnwindSafe,
<T as LazyBalance>::Subject: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DefensiveMax<T> for Twhere
T: PartialOrd,
impl<T> DefensiveMax<T> for Twhere
T: PartialOrd,
§fn defensive_max(self, other: T) -> T
fn defensive_max(self, other: T) -> T
§fn defensive_strict_max(self, other: T) -> T
fn defensive_strict_max(self, other: T) -> T
§impl<T> DefensiveMin<T> for Twhere
T: PartialOrd,
impl<T> DefensiveMin<T> for Twhere
T: PartialOrd,
§fn defensive_min(self, other: T) -> T
fn defensive_min(self, other: T) -> T
§fn defensive_strict_min(self, other: T) -> T
fn defensive_strict_min(self, other: T) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U, Tag> IntoTag<U, Tag> for Twhere
U: FromTag<T, Tag>,
Tag: DiscriminantTag,
impl<T, U, Tag> IntoTag<U, Tag> for Twhere
U: FromTag<T, Tag>,
Tag: DiscriminantTag,
§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T, Time> Logging<Time> for Twhere
Time: Time,
impl<T, Time> Logging<Time> for Twhere
Time: Time,
Source§const FALLBACK_TARGET: &'static str = const FALLBACK_TARGET: &'_ str = "routine";
const FALLBACK_TARGET: &'static str = const FALLBACK_TARGET: &'_ str = "routine";
Default logging target if none is provided.
Most routines, especially offchain workers or background tasks, use this target for simplicity.
It allows a consistent place to look for routine logs without requiring every call to specify a target.
Note: This target is only a conveninence and may be somewhat vague. To ensure errors can still be traced accurately, the logged messages should include additional metadata (e.g., module name, error index, or contextual info) so that the source of the error can be identified even if the target is generic.
Source§type Logger = DispatchError
type Logger = DispatchError
The type taken and returned for logging.
We simply return the same [DispatchError] that was logged,
so logging does not change control flow or error propagation.
DispatchError is used because in Substrate it encompasses all
runtime errors - including module errors, token errors, arithmetic
issues, and transactional boundaries - making it the universal
substrate-side error representation.
Source§type Level = LogLevel
type Level = LogLevel
The log level type.
We use the LogLevel enum to standardize severity levels
(Info, Warn, Error, Debug) across all routine logs.
Source§fn log(
level: <T as Logging<Time>>::Level,
err: &<T as Logging<Time>>::Logger,
timestamp: Time,
target: Option<&str>,
fmt: Option<fn(Time, &<T as Logging<Time>>::Level, &str, &str) -> String>,
) -> <T as Logging<Time>>::Logger
fn log( level: <T as Logging<Time>>::Level, err: &<T as Logging<Time>>::Logger, timestamp: Time, target: Option<&str>, fmt: Option<fn(Time, &<T as Logging<Time>>::Level, &str, &str) -> String>, ) -> <T as Logging<Time>>::Logger
Source§fn info(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<LogFormatter<Timestamp, Self::Level>>,
) -> Self::Loggerwhere
Self: Sized,
fn info(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<LogFormatter<Timestamp, Self::Level>>,
) -> Self::Loggerwhere
Self: Sized,
Source§fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<LogFormatter<Timestamp, Self::Level>>,
) -> Self::Loggerwhere
Self: Sized,
fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<LogFormatter<Timestamp, Self::Level>>,
) -> Self::Loggerwhere
Self: Sized,
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read more§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.