pub trait XpReserveListener{
// Provided methods
fn reserve_updated(
_key: &Key<Self::Via>,
_reason: &ReserveReason<Self::Via>,
_total_points: Points<Self::Via>,
) { ... }
fn reserve_slashed(
_key: &Key<Self::Via>,
_reason: &ReserveReason<Self::Via>,
_slashed_points: Points<Self::Via>,
) { ... }
}Expand description
Listener trait for XP reserving events.
This listener is invoked on xp reserving (e.g., updates, slashes, burns),
if the XpReserve implementor chooses to call it.
It allows implementors to hook into reserve 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.
Provided Methods§
Sourcefn reserve_updated(
_key: &Key<Self::Via>,
_reason: &ReserveReason<Self::Via>,
_total_points: Points<Self::Via>,
)
fn reserve_updated( _key: &Key<Self::Via>, _reason: &ReserveReason<Self::Via>, _total_points: Points<Self::Via>, )
Called when an XP reserve update event occurs.
Points reflect total reserved points for the runtime reserve reason.
§Note
This does not imply a slashing event. An update may result from:
- Depositing XP into a reserve (increase), or
- Withdrawing XP from a reserve (decrease).
Sourcefn reserve_slashed(
_key: &Key<Self::Via>,
_reason: &ReserveReason<Self::Via>,
_slashed_points: Points<Self::Via>,
)
fn reserve_slashed( _key: &Key<Self::Via>, _reason: &ReserveReason<Self::Via>, _slashed_points: Points<Self::Via>, )
Called when an XP reserve burn event occurs.
Points reflect total slashed points for the runtime reserve reason.
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.