Trait XpMutateListener

Source
pub trait XpMutateListener
where Self: XpOwnerListener, Self::Via: XpMutate,
{ // Provided methods fn xp_created(_key: &Key<Self::Via>, _owner: &Owner<Self::Via>) { ... } fn xp_earned(_key: &Key<Self::Via>, _earned_points: Points<Self::Via>) { ... } fn xp_slashed(_key: &Key<Self::Via>, _slashed_points: Points<Self::Via>) { ... } fn xp_resetted(_key: &Key<Self::Via>) { ... } fn xp_updated(_key: &Key<Self::Via>, _current_points: Points<Self::Via>) { ... } }
Expand description

Listener trait for XP mutation events.

This listener is invoked on XP mutations (e.g., create, earn, slash, burn), if the XpMutate implementor chooses to call it.

It allows implementors to hook into mutation events for triggering external logic.

§Note

Listener hooks are best-effort and should be fail-safe. Implementations may choose to invoke them selectively or not at all, so triggered logic must not rely on guaranteed execution (unless the provider guarantees it).

Provided Methods§

Source

fn xp_created(_key: &Key<Self::Via>, _owner: &Owner<Self::Via>)

Called when a new XP identity is created.

Source

fn xp_earned(_key: &Key<Self::Via>, _earned_points: Points<Self::Via>)

Called when XP is earned for a given key.

Points reflect the amount earned in this operation.

Source

fn xp_slashed(_key: &Key<Self::Via>, _slashed_points: Points<Self::Via>)

Called when XP is slashed for a given key.

Points reflect the amount reduced in this operation.

Source

fn xp_resetted(_key: &Key<Self::Via>)

Called when XP is reset for a given key.

This reflects a complete reset of the liquid XP balance.

Source

fn xp_updated(_key: &Key<Self::Via>, _current_points: Points<Self::Via>)

Called when XP is updated for a given key without a specific intent.

Points reflect the current liquid XP after the update.

This is typically used for internal adjustments, migrations, or reconciliation where the change is not categorized as earning, slashing, or resetting but could be without being explicit.

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§