pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);Expand description
Primary Marker type for the XP pallet.
This pallet provides implementations for traits from:
§Fungible Trait Implementations
The pallet implements the following fungible-related traits:
§XP Trait Implementations
Pallet implements the core XP system traits:
§Helper Traits
Additional supporting traits:
Tuple Fields§
§0: PhantomData<(T, I)>Implementations§
Source§impl<T: Config<I>, I: 'static> Pallet<T, I>
XP Pallet Extrinsics includes major state mutation functions with
origin authentication. Some read only functions are given for
impl<T: Config<I>, I: 'static> Pallet<T, I>
XP Pallet Extrinsics includes major state mutation functions with origin authentication. Some read only functions are given for
Sourcepub fn call(
origin: OriginFor<T>,
xp_id: XpId<T>,
call: Box<<T as Config<I>>::RuntimeCall>,
) -> DispatchResult
pub fn call( origin: OriginFor<T>, xp_id: XpId<T>, call: Box<<T as Config<I>>::RuntimeCall>, ) -> DispatchResult
Executes a runtime call using an XP identity as the origin.
Origin: Signed (must be the owner of the XP identity)
This extrinsic allows the owner of an XP identity to dispatch a call on its behalf. While an XP identity is not a native account, it can act as a logical origin for execution through owner authorization.
The caller must be the registered owner of the given xp_id.
Upon successful verification, the provided call is dispatched
with the XP identity as the signed origin.
Sourcepub fn handover(
origin: OriginFor<T>,
xp_id: XpId<T>,
new_owner: T::AccountId,
) -> DispatchResult
pub fn handover( origin: OriginFor<T>, xp_id: XpId<T>, new_owner: T::AccountId, ) -> DispatchResult
Transfer or handover ownership of an XP key to another account.
Origin: Signed user (must be the current XP key owner)
This extrinsic allows the current owner of an XP key to transfer ownership to another account. The call will fail if the destination account is already the owner or if the caller does not own the XP key.
On success, ownership of the XP key is transferred to the target account and an event is emitted.
Emits Event::XpOwner with the XP key and new owner.
Sourcepub fn dispose(
origin: OriginFor<T>,
owner: T::AccountId,
xp_id: XpId<T>,
) -> DispatchResult
pub fn dispose( origin: OriginFor<T>, owner: T::AccountId, xp_id: XpId<T>, ) -> DispatchResult
Dispose (Reap) an XP key.
Origin: Signed user
This extrinsic allows any signed account to finalize and remove XP entries that are no longer valid.
For an XP key, it checks:
- The key exists in storage,
- The key is considered “dead” (does not meet minimum timestamp requirements),
- The key has no active locks.
If all checks pass, the XP entry is reaped (removed from storage and blacklisted).
Emits Event::XpReap with each successfully reaped XP key.
Sourcepub fn force_handover(
origin: OriginFor<T>,
owner: T::AccountId,
xp_id: XpId<T>,
new_owner: T::AccountId,
) -> DispatchResult
pub fn force_handover( origin: OriginFor<T>, owner: T::AccountId, xp_id: XpId<T>, new_owner: T::AccountId, ) -> DispatchResult
Force transfer/handover ownership of an XP key to another account.
Origin: Root only
This extrinsic allows the current owner of an XP key to transfer ownership to another account. The call will fail if the destination account is already the owner or if the caller does not own the XP key.
On success, ownership of the XP key is transferred to the target account and an event is emitted.
Emits Event::XpOwner with the XP key and new owner.
Sourcepub fn force_genesis_config(
origin: OriginFor<T>,
field: ForceGenesisConfig<T, I>,
) -> DispatchResult
pub fn force_genesis_config( origin: OriginFor<T>, field: ForceGenesisConfig<T, I>, ) -> DispatchResult
Force-update a selected genesis configuration parameter.
Origin: Root only.
This extrinsic allows privileged modification of runtime parameters that were originally defined at genesis.
The parameter to update is specified via the ForceGenesisConfig enum:
MinPulse- Updates the minimum pulse required for reputation effects.InitXp- Updates the initial XP assigned to newly created XP entries.PulseFactor- Updates the pulse stepping configuration (thresholdandper_count).MinTimeStamp- Updated the minimum blocks required for an XP entry to be considered alive.
For PulseFactor, the call fails with Error::LowPulseThreshold
if per_count > threshold, as this would invalidate the stepping logic.
This call directly overwrites storage and emits an event containing the updated configuration variant.
Source§impl<T: Config<I>, I: 'static> Pallet<T, I>
Public read-only functions for inspecting XP balances, reputation,
and pulse progression state.
impl<T: Config<I>, I: 'static> Pallet<T, I>
Public read-only functions for inspecting XP balances, reputation, and pulse progression state.
This interface exposes non-mutating functions that allow external
consumers (e.g. off-chain clients, RPC layers, other pallets, UI layers,
and gamification engines) to inspect XP ownership, multiplier status,
reputation progress, and simulate earn_xp outcomes without modifying
on-chain state.
Sourcepub fn xp_state(key: &XpId<T>) -> Result<XpState<T, I>, DispatchError>
pub fn xp_state(key: &XpId<T>) -> Result<XpState<T, I>, DispatchError>
Returns the current XP state snapshot for an identity.
Combines balances, XP eligibility, and effective multiplier.
Intended for RPC responses and UI views.
Sourcepub fn xp(key: &XpId<T>) -> Result<T::Xp, DispatchError>
pub fn xp(key: &XpId<T>) -> Result<T::Xp, DispatchError>
Returns the current liquid (free, spendable) XP of the given xp_id.
This excludes reserved and locked balances.
Sourcepub fn xp_keys(owner: &T::AccountId) -> Result<Vec<XpId<T>>, DispatchError>
pub fn xp_keys(owner: &T::AccountId) -> Result<Vec<XpId<T>>, DispatchError>
Returns all XP IDs owned by the given owner.
Sourcepub fn is_disposable(key: &XpId<T>) -> DispatchResult
pub fn is_disposable(key: &XpId<T>) -> DispatchResult
Checks whether the given XP key can be safely disposed (finalized).
Sourcepub fn xp_eligibility(
key: &XpId<T>,
) -> Result<XpEligibility<T, I>, DispatchError>
pub fn xp_eligibility( key: &XpId<T>, ) -> Result<XpEligibility<T, I>, DispatchError>
Returns the XP eligibility state of an identity.
If XP is already active (pulse.value >= MinPulse), returns Earning.
Otherwise, computes how many additional blocks with at least one
earn_xp call are required before XP starts being counted.
This calculation accounts for:
- Current partial progression toward the next pulse increment
- Pulse threshold
- Progress gained per block (via
earn_xp)
Note: Multiple earn_xp calls within the same block are treated
as a single progression step.
Intended for RPC queries, previews, and UI interactions.
Sourcepub fn xp_multiplier(key: &XpId<T>) -> Result<Option<T::Pulse>, DispatchError>
pub fn xp_multiplier(key: &XpId<T>) -> Result<Option<T::Pulse>, DispatchError>
Returns the applicable XP multiplier for an identity.
Once XP is active, the multiplier is derived from the current pulse value. The multiplier can be applied at most once per block.
Returns:
Some(multiplier)if a multiplier is available for the nextearn_xpcallNoneif no multiplier applies, which occurs when:- XP is not valid or active (see
Self::xp_eligibility), or - A multiplier has already been applied in the current block
- XP is not valid or active (see
Note:
- Subsequent
earn_xpcalls within the same block are unscaled.
Intended for RPC queries, previews, and UI interactions.
Sourcepub fn xp_progress(key: &XpId<T>) -> Result<XpProgress<T, I>, DispatchError>
pub fn xp_progress(key: &XpId<T>) -> Result<XpProgress<T, I>, DispatchError>
Returns the current XP progression details.
Includes the current multiplier level, progress toward the next level, and the configuration that defines how progression advances.
Intended for UI progress bars and gamified displays.
Sourcepub fn earn_preview(
key: &XpId<T>,
raw: T::Xp,
) -> Result<XpState<T, I>, DispatchError>
pub fn earn_preview( key: &XpId<T>, raw: T::Xp, ) -> Result<XpState<T, I>, DispatchError>
Simulates an earn_xp action and returns the resulting XP state.
Executes the same logic as earn_xp without mutating storage,
allowing callers to preview how an action would affect balances,
XP activation, and multiplier.
Behavior:
- If XP is not yet active, the action contributes only toward activation (no reward scaling is applied).
- If XP is active, the input is scaled by the current multiplier (if any).
- Progression toward the next multiplier level is updated accordingly.
The returned XpState reflects the post-action state as if the
operation had been applied.
Intended for RPC queries, previews, and UI interactions.
Sourcepub fn xp_last_earn(key: &XpId<T>) -> Result<BlockNumberFor<T>, DispatchError>
pub fn xp_last_earn(key: &XpId<T>) -> Result<BlockNumberFor<T>, DispatchError>
Returns the block number of the last earn_xp execution.
This value is used to enforce per-block rules, such as:
- Allowing at most one multiplier application per block
- Preventing multiple progression steps within the same block
Intended for RPC queries, previews, and UI interactions.
Trait Implementations§
Source§impl<T: Config<I>, I: 'static> BeforeAllRuntimeMigrations for Pallet<T, I>
impl<T: Config<I>, I: 'static> BeforeAllRuntimeMigrations for Pallet<T, I>
Source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
Source§impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>
type RuntimeCall = Call<T, I>
Source§impl<T: Config<I>, I: 'static> DiscreteAccumulator for Pallet<T, I>
Implementation of the DiscreteAccumulator trait for the XP pallet.
impl<T: Config<I>, I: 'static> DiscreteAccumulator for Pallet<T, I>
Implementation of the DiscreteAccumulator trait for the XP pallet.
This trait provides an abstraction for accumulator data structures that can be incremented or decremented by discrete steps, while maintaining an internal state that can be revealed as a readable value.
The accumulator increases its value when enough fractional steps have been collected to reach the threshold. Similarly, it decreases its value when enough steps are removed, handling underflow and overflow gracefully.
Source§type Accumulator = Accumulator<T, I>
type Accumulator = Accumulator<T, I>
The accumulator structure holding the current value and step count.
Source§type Stepper = Stepper<T, I>
type Stepper = Stepper<T, I>
The stepper configuration, defining the threshold and per-step increment.
Source§fn increment(accum: &mut Self::Accumulator, stepper: &Self::Stepper)
fn increment(accum: &mut Self::Accumulator, stepper: &Self::Stepper)
Increments the accumulator by the stepper’s per-count value.
When the accumulated step reaches or exceeds the threshold, the value is increased by one and the step is reduced accordingly. Handles overflow gracefully using saturating arithmetic.
Source§fn decrement(accum: &mut Self::Accumulator, stepper: &Self::Stepper)
fn decrement(accum: &mut Self::Accumulator, stepper: &Self::Stepper)
Decrements the accumulator by the stepper’s per-count value.
If the current step is greater than or equal to the per-count, it simply subtracts per-count from the step. Otherwise, it calculates the deficit needed to maintain a non-negative step.
If the value is > 0, subtract 1, and set step to deficit, else set step to 0.
Source§fn reveal(accum: &Self::Accumulator) -> Self::Value
fn reveal(accum: &Self::Accumulator) -> Self::Value
Reveals the current accumulated value from the internal state.
Returns the main value of the accumulator, ignoring the fractional step.
Source§impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
Source§type InCodeStorageVersion = NoStorageVersionSet
type InCodeStorageVersion = NoStorageVersionSet
Source§fn in_code_storage_version() -> Self::InCodeStorageVersion
fn in_code_storage_version() -> Self::InCodeStorageVersion
storage_version attribute, or
[NoStorageVersionSet] if the attribute is missing.Source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version and will be removed after March 2024.Self::current_storage_version] instead. Read moreSource§impl<T: Config<I>, I: 'static> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize]). Read more§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive pallet. Read more§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
§fn integrity_test()
fn integrity_test()
Source§impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
Source§fn total_issuance() -> Self::Balance
fn total_issuance() -> Self::Balance
Always panics!. XP does not support total issuance.
XP does not track total issuance since it is earned based on work or intent-specific contributions.
There is no inflation model, as each XP point has individual meaning tied to context.
While XP units may be comparable numerically, they are not issued under the assumption of fungibility. XP providers define how XP is earned, not through a global issuance mechanism.
For runtime intents or abstractions which intend to operate on Fungible implementations
such as pallet_balances and pallet_xp, callers should treat this as a no-op and utilize
other trait extensions such as [Unbalanced]
Source§fn minimum_balance() -> Self::Balance
fn minimum_balance() -> Self::Balance
Returns the minimum balance required for an XP to be considered alive.
XP reaping is not solely determined by balance. An XP entry may still be valid even if fully consumed, since XP can be re-earned through further work or actions.
Therefore, we assume no minimum balance is necessary to keep an XP alive.
Instead, XP lifecycle management (e.g., determining dead XP) should rely on other
runtime mechanisms, such as timestamps crate::MinTimeStamp.
Consumers of this trait may implement automated reaping by integrating with
functions like xp_exists or by analyzing XP activity rather than static balances.
This value is deliberately zero to support such flexible lifecycle handling.
Source§fn total_balance(who: &XpId<T>) -> Self::Balance
fn total_balance(who: &XpId<T>) -> Self::Balance
Returns the total usable XP balance for the given key.
If the XP entry does not exist, this function returns zero as a fallback.
Unlike liquid XP, which refers only to the free portion, the usable XP
includes both free and reserved portions - making this function more suited
for systems that consider total accessible XP rather than just transferable XP.
This method relies on XpSystem::get_usable_xp.
Note:
- This is provided to conform to the
Fungibletrait expectations. - While XP is not inherently fungible,
total_balanceallows integration in systems assuming that a balance-like arithmetic abstraction is available.
Source§fn balance(who: &XpId<T>) -> Self::Balance
fn balance(who: &XpId<T>) -> Self::Balance
Returns the liquid XP balance for the given key.
If the XP does not exist, this returns zero.
Liquid XP represents the freely accessible portion of XP - that is, XP that is not locked or reserved and is available for immediate use.
This method relies on XpSystem::get_liquid_xp.
Note:
- This method aligns with the
Fungibletrait’sbalanceexpectation, even though XP is not strictly fungible. - It provides the free XP as a proxy for the “spendable” amount.
Source§fn reducible_balance(
who: &XpId<T>,
_preservation: Preservation,
_force: Fortitude,
) -> Self::Balance
fn reducible_balance( who: &XpId<T>, _preservation: Preservation, _force: Fortitude, ) -> Self::Balance
Returns the amount of XP that can be reduced (i.e., slashed or withdrawn) for the given Xp key.
XP is not subject to existential deposit or minimum balance preservation like standard fungible assets.
If the XP does not exist, this returns zero.
This method relies on XpSystem::get_liquid_xp.
The _preservation and _force parameter is ignored as XP does not implement minimum
balance enforcement.
Source§fn can_deposit(
who: &XpId<T>,
amount: Self::Balance,
provenance: Provenance,
) -> DepositConsequence
fn can_deposit( who: &XpId<T>, amount: Self::Balance, provenance: Provenance, ) -> DepositConsequence
Determines whether XP can be deposited into the account of the given XP key.
Returns a DepositConsequence indicating whether the XP deposit is allowed.
§Rules
- XP cannot be minted arbitrarily. Only providers with internal logic may
assign new XP using
XpMutate::earn_xp. - If the provenance is [
Provenance::Minted], the deposit is always blocked. - While direct deposit minting is blocked, it is always preferable to allow minting in
XP and balance systems using the safe
Balancedtrait to issue new balance and increase the balance of an account. - If the XP does not exist for the given key (
XpSystem::xp_existsreturnsfalse), the deposit is blocked, because creating a new XP key should only be done via the Xp TraitXpMutate::new_xpor via genesis-config xp-accounts. - A zero-amount deposit is a success (considered a no-op).
- Deposits are allowed only if the new liquid XP will not overflow.
Source§fn can_withdraw(
who: &XpId<T>,
amount: Self::Balance,
) -> WithdrawConsequence<Self::Balance>
fn can_withdraw( who: &XpId<T>, amount: Self::Balance, ) -> WithdrawConsequence<Self::Balance>
Determines whether a given amount of XP can be withdrawn from the given XP key.
Returns a WithdrawConsequence indicating whether the amount of XP can be withdrawn.
§Behavior
- If the amount is
zero, the withdrawal is trivially allowed. - If the XP key does not exist, returns
UnknownAsset. - Checks whether the amount can be covered using the liquid/free XP balance.
If the balance is insufficient, returns
BalanceLow. Otherwise, returnsSuccess.
Source§fn active_issuance() -> Self::Balance
fn active_issuance() -> Self::Balance
Always panics!. XP does not maintain an active issuance count.
Similar to total_issuance, XP is not issued in a globally managed or inflating manner.
The amount of XP granted is determined by the provider, and the XP system only defines how such points are added or interpreted.
Since XP is only numerically comparable (pseudo-fungible) but not truly fungible, no active issuance is tracked to prevent any notion of inflation or global supply.
Callers expecting issuance metrics (e.g., for fungible traits) should treat this
as a no-op and utilize other trait extensions such as Fungible::Balanced or
Fungible::Unbalanced.
Source§impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
Source§fn balance_frozen(id: &Self::Id, who: &XpId<T>) -> Self::Balance
fn balance_frozen(id: &Self::Id, who: &XpId<T>) -> Self::Balance
Returns the locked (frozen) XP of the given lock id of XP Key.
Returns zero if no lock is found.
Source§fn can_freeze(id: &Self::Id, who: &XpId<T>) -> bool
fn can_freeze(id: &Self::Id, who: &XpId<T>) -> bool
Checks if XP can be locked (frozen) for the given lock id and XP key.
Returns true if:
- The XP key exists.
- No lock currently exists for the given
id.
Returns false otherwise.
§fn balance_freezable(who: &AccountId) -> Self::Balance
fn balance_freezable(who: &AccountId) -> Self::Balance
total_balance().Source§impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
Source§type Reason = <Pallet<T, I> as XpReserve>::ReserveReason
type Reason = <Pallet<T, I> as XpReserve>::ReserveReason
The reserve reason identifier used to categorize reserved XP points.
Source§fn total_balance_on_hold(who: &XpId<T>) -> Self::Balance
fn total_balance_on_hold(who: &XpId<T>) -> Self::Balance
Returns the total reserved XP for the given XP key.
- If the XP does not exist, returns
zero.
Note: This function cannot definitively determine whether an XP exists solely
based on the returned value, since inactive or uninitialized reserves on an
active XP will also return zero.
Source§fn balance_on_hold(reason: &Self::Reason, who: &XpId<T>) -> Self::Balance
fn balance_on_hold(reason: &Self::Reason, who: &XpId<T>) -> Self::Balance
Returns the reserved XP held for the given reason by the specified XP key.
- Returns
zeroif the XP key does not have an active reserve for the given reason, or if the reserve exists but has been fully reduced (i.e., balance is zero).
Note: Due to the design of the Fungible Traits, a reserve may still technically exist
even if its balance is zero. Therefore, this method does not distinguish between
a fully depleted reserve and a non-existent one.
§fn reducible_total_balance_on_hold(
who: &AccountId,
_force: Fortitude,
) -> Self::Balance
fn reducible_total_balance_on_hold( who: &AccountId, _force: Fortitude, ) -> Self::Balance
total_balance_on_hold of who can be reduced successfully
based on whether we are willing to force the reduction and potentially go below user-level
restrictions on the minimum amount of the account. Note: This cannot bring the account into
an inconsistent state with regards any required existential deposit. Read more§fn hold_available(_reason: &Self::Reason, _who: &AccountId) -> bool
fn hold_available(_reason: &Self::Reason, _who: &AccountId) -> bool
true if it’s possible to place (additional) funds under a hold of a given
reason. This may fail if the account has exhausted a limited number of concurrent
holds or if it cannot be made to exist (e.g. there is no provider reference). Read more§fn ensure_can_hold(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
) -> Result<(), DispatchError>
fn ensure_can_hold( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>
amount of funds of who may be placed on hold with the given
reason. Reasons why this may not be true: Read more§fn can_hold(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
) -> bool
fn can_hold( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, ) -> bool
amount of funds of who may be placed on hold for the given
reason. Reasons why this may not be true: Read moreSource§impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
Source§fn integrity_test()
fn integrity_test()
Hooks::integrity_test].Source§impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
Source§fn mint_into(
who: &XpId<T>,
amount: Self::Balance,
) -> Result<Self::Balance, DispatchError>
fn mint_into( who: &XpId<T>, amount: Self::Balance, ) -> Result<Self::Balance, DispatchError>
Mints (adds) amount XP to the given XP key.
- Fails if the XP key does not exist.
- Fails on overflow.
- Calls
done_mint_intoafter successful mint. - Returns the actual amount minted (the imbalance).
Source§fn burn_from(
who: &XpId<T>,
amount: Self::Balance,
preservation: Preservation,
precision: Precision,
force: Fortitude,
) -> Result<Self::Balance, DispatchError>
fn burn_from( who: &XpId<T>, amount: Self::Balance, preservation: Preservation, precision: Precision, force: Fortitude, ) -> Result<Self::Balance, DispatchError>
Burns (removes) up to amount XP from the given XP key.
- Fails if the XP key does not exist.
- Fails if funds are unavailable and precision is
Exact. - Calls
done_burn_fromafter successful burn. - Returns the actual amount burned (the imbalance).
Source§fn shelve(
who: &XpId<T>,
amount: Self::Balance,
) -> Result<Self::Balance, DispatchError>
fn shelve( who: &XpId<T>, amount: Self::Balance, ) -> Result<Self::Balance, DispatchError>
Shelves (removes) up to amount XP from the given XP key.
- Fails if funds are unavailable.
- Returns the actual amount shelved (the imbalance).
Source§fn restore(
who: &XpId<T>,
amount: Self::Balance,
) -> Result<Self::Balance, DispatchError>
fn restore( who: &XpId<T>, amount: Self::Balance, ) -> Result<Self::Balance, DispatchError>
Restores (adds) amount XP to the given XP key.
- Fails if the XP key does not exist.
- Fails on overflow.
- Returns the actual amount restored (the imbalance).
Source§fn transfer(
_source: &XpId<T>,
_dest: &XpId<T>,
_amount: Self::Balance,
_preservation: Preservation,
) -> Result<Self::Balance, DispatchError>
fn transfer( _source: &XpId<T>, _dest: &XpId<T>, _amount: Self::Balance, _preservation: Preservation, ) -> Result<Self::Balance, DispatchError>
Transfers XP between keys is not supported.
Always returns Error::CannotTransferXp.
Source§fn set_balance(who: &XpId<T>, amount: Self::Balance) -> Self::Balance
fn set_balance(who: &XpId<T>, amount: Self::Balance) -> Self::Balance
Sets the free XP balance for the given XP key.
- Returns
zeroif the XP key does not exist. - Otherwise, sets the free balance and returns the new balance.
Source§fn done_burn_from(who: &XpId<T>, amount: Self::Balance)
fn done_burn_from(who: &XpId<T>, amount: Self::Balance)
Called after a successful burn operation.
Triggers XP update hook.
Source§fn done_mint_into(who: &XpId<T>, amount: Self::Balance)
fn done_mint_into(who: &XpId<T>, amount: Self::Balance)
Called after a successful mint operation.
Triggers XP update hook.
Source§fn done_restore(who: &XpId<T>, amount: Self::Balance)
fn done_restore(who: &XpId<T>, amount: Self::Balance)
Called after a successful restore operation.
Triggers XP update hook.
Source§fn done_shelve(who: &XpId<T>, amount: Self::Balance)
fn done_shelve(who: &XpId<T>, amount: Self::Balance)
Called after a successful shelve operation.
Triggers XP update hook.
Source§fn done_transfer(_source: &XpId<T>, _dest: &XpId<T>, _amount: Self::Balance)
fn done_transfer(_source: &XpId<T>, _dest: &XpId<T>, _amount: Self::Balance)
This implementation is a no-op.
Source§impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
Source§fn set_freeze(
id: &Self::Id,
who: &XpId<T>,
amount: Self::Balance,
) -> DispatchResult
fn set_freeze( id: &Self::Id, who: &XpId<T>, amount: Self::Balance, ) -> DispatchResult
Sets or updates the locked XP (freeze) for the given id and XP Key.
- If
amountiszeroand lock exists for the givenkeyandidthis operation is treated as a thaw (i.e., burn/remove the lock). - If the lock exists,
XpLock::can_lock_mutatemust returnOk(())to allow the update. - If the lock does not exist,
XpLock::can_lock_newmust returnOk(())to allow creating a new lock.
Returns Ok(()) on success, or an error if the operation fails.
Source§fn extend_freeze(
id: &Self::Id,
who: &XpId<T>,
amount: Self::Balance,
) -> DispatchResult
fn extend_freeze( id: &Self::Id, who: &XpId<T>, amount: Self::Balance, ) -> DispatchResult
Extends (or sets) a lock (freeze) for the given lock id of the
specified XP key.
- If the lock exists, increases the locked amount to the greater of the current or requested value.
- If the lock does not exist, returns an error (
XpLockNotFound). - If
amountiszero, this is a no-op and returnsOk(()).
Source§fn thaw(id: &Self::Id, who: &XpId<T>) -> DispatchResult
fn thaw(id: &Self::Id, who: &XpId<T>) -> DispatchResult
Thaws (removes) the XP lock for the given lock id of the specified XP key.
This is effectively a lock burn as it permanently removes the lock.
- Fails if the XP key does not exist.
- Fails if the lock does not exist.
Source§fn increase_frozen(
id: &Self::Id,
who: &XpId<T>,
amount: Self::Balance,
) -> DispatchResult
fn increase_frozen( id: &Self::Id, who: &XpId<T>, amount: Self::Balance, ) -> DispatchResult
Increase the amount which is being frozen for a particular freeze, failing in the case that too little balance is available for being frozen.
§fn set_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
fortitude: Fortitude,
) -> Result<(), DispatchError>
fn set_frozen( id: &Self::Id, who: &AccountId, amount: Self::Balance, fortitude: Fortitude, ) -> Result<(), DispatchError>
§fn ensure_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
fortitude: Fortitude,
) -> Result<(), DispatchError>
fn ensure_frozen( id: &Self::Id, who: &AccountId, amount: Self::Balance, fortitude: Fortitude, ) -> Result<(), DispatchError>
id to amount, iff this would increase
the amount frozen under id. Do nothing otherwise. Read more§fn decrease_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> Result<(), DispatchError>
fn decrease_frozen( id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>
Source§impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
§fn hold(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
) -> Result<(), DispatchError>
fn hold( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>
reason is already in place, then this
will increase it.§fn release(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
precision: Precision,
) -> Result<Self::Balance, DispatchError>
fn release( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, ) -> Result<Self::Balance, DispatchError>
amount held funds in an account. Read more§fn set_on_hold(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
) -> Result<(), DispatchError>
fn set_on_hold( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>
who to bring the balance on hold for reason to
exactly amount.§fn release_all(
reason: &Self::Reason,
who: &AccountId,
precision: Precision,
) -> Result<Self::Balance, DispatchError>
fn release_all( reason: &Self::Reason, who: &AccountId, precision: Precision, ) -> Result<Self::Balance, DispatchError>
§fn burn_held(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
precision: Precision,
force: Fortitude,
) -> Result<Self::Balance, DispatchError>
fn burn_held( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, force: Fortitude, ) -> Result<Self::Balance, DispatchError>
§fn burn_all_held(
reason: &Self::Reason,
who: &AccountId,
precision: Precision,
force: Fortitude,
) -> Result<Self::Balance, DispatchError>
fn burn_all_held( reason: &Self::Reason, who: &AccountId, precision: Precision, force: Fortitude, ) -> Result<Self::Balance, DispatchError>
§fn transfer_on_hold(
reason: &Self::Reason,
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
precision: Precision,
mode: Restriction,
force: Fortitude,
) -> Result<Self::Balance, DispatchError>
fn transfer_on_hold( reason: &Self::Reason, source: &AccountId, dest: &AccountId, amount: Self::Balance, precision: Precision, mode: Restriction, force: Fortitude, ) -> Result<Self::Balance, DispatchError>
§fn transfer_and_hold(
reason: &Self::Reason,
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
precision: Precision,
expendability: Preservation,
force: Fortitude,
) -> Result<Self::Balance, DispatchError>
fn transfer_and_hold( reason: &Self::Reason, source: &AccountId, dest: &AccountId, amount: Self::Balance, precision: Precision, expendability: Preservation, force: Fortitude, ) -> Result<Self::Balance, DispatchError>
amount of free balance from source to become owned by dest but on hold
for reason. Read morefn done_hold(_reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance)
fn done_release( _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance, )
fn done_burn_held( _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance, )
fn done_transfer_on_hold( _reason: &Self::Reason, _source: &AccountId, _dest: &AccountId, _amount: Self::Balance, )
fn done_transfer_and_hold( _reason: &Self::Reason, _source: &AccountId, _dest: &AccountId, _transferred: Self::Balance, )
Source§impl<T: Config<I>, I: 'static> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
Source§impl<T: Config<I>, I: 'static> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize].Source§impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
Source§fn on_genesis()
fn on_genesis()
Source§impl<T: Config<I>, I: 'static> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize].Source§impl<T: Config<I>, I: 'static> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade].Source§impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
Source§fn module_name() -> &'static str
fn module_name() -> &'static str
Source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Source§impl<T: Config<I>, I: 'static> StorageInfoTrait for Pallet<T, I>
impl<T: Config<I>, I: 'static> StorageInfoTrait for Pallet<T, I>
fn storage_info() -> Vec<StorageInfo>
Source§impl<T: Config<I>, I: 'static> Unbalanced<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Unbalanced<<T as Config>::AccountId> for Pallet<T, I>
Source§fn handle_dust(_dust: Dust<XpId<T>, Self>)
fn handle_dust(_dust: Dust<XpId<T>, Self>)
XP operations may generate imprecise or saturating side-effects (e.g., dust due to overflow control), which are handled internally by the XP system. XP accounts can exist at zero points, so it is assumed no such dust will be created.
Therefore, this implementation is a no-op.
Source§fn write_balance(
who: &XpId<T>,
amount: Self::Balance,
) -> Result<Option<Self::Balance>, DispatchError>
fn write_balance( who: &XpId<T>, amount: Self::Balance, ) -> Result<Option<Self::Balance>, DispatchError>
Writes the free XP balance for the given key.
This bypasses XP earning mechanisms and directly sets the XP to the specified value.
We return None intentionally to indicate no dust may exist.
Source§fn set_total_issuance(_amount: Self::Balance)
fn set_total_issuance(_amount: Self::Balance)
The XP system does not support active or total issuance.
Therefore, this implementation is a no-op.
Source§fn handle_raw_dust(_amount: Self::Balance)
fn handle_raw_dust(_amount: Self::Balance)
This implementation is a no-op.
Source§fn increase_balance(
who: &XpId<T>,
amount: Self::Balance,
precision: Precision,
) -> Result<Self::Balance, DispatchError>
fn increase_balance( who: &XpId<T>, amount: Self::Balance, precision: Precision, ) -> Result<Self::Balance, DispatchError>
Increases the balance of who by amount.
If the balance cannot be increased by that amount for any reason,
returns Err and does not increase it at all.
If successful, returns the amount by which the balance was increased (the imbalance).
Source§fn decrease_balance(
who: &XpId<T>,
amount: Self::Balance,
precision: Precision,
preservation: Preservation,
force: Fortitude,
) -> Result<Self::Balance, DispatchError>
fn decrease_balance( who: &XpId<T>, amount: Self::Balance, precision: Precision, preservation: Preservation, force: Fortitude, ) -> Result<Self::Balance, DispatchError>
Decreases the balance of who by amount.
- If
precisionisExactand the balance cannot be reduced by that amount, returnsErrand does not reduce it at all. - If
precisionisBestEffort, reduces the balance by as much as possible, up toamount.
In either case, if Ok is returned, the inner value is the amount by
which the balance was reduced.
Source§fn deactivate(_: Self::Balance)
fn deactivate(_: Self::Balance)
This implementation is a no-op.
Source§fn reactivate(_: Self::Balance)
fn reactivate(_: Self::Balance)
This implementation is a no-op.
Source§impl<T: Config<I>, I: 'static> Unbalanced<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Unbalanced<<T as Config>::AccountId> for Pallet<T, I>
Source§fn set_balance_on_hold(
reason: &Self::Reason,
who: &XpId<T>,
amount: Self::Balance,
) -> DispatchResult
fn set_balance_on_hold( reason: &Self::Reason, who: &XpId<T>, amount: Self::Balance, ) -> DispatchResult
Sets or updates the reserved XP (balance_on_hold) for a given reason
of XP key.
- If
amountis zero, the function does not create or modify any reserve. - If the reserve exists,
XpReserve::can_reserve_mutatemust returnOk(())to allow the update. - If the reserve does not exist,
XpReserve::can_reserve_newmust returnOk(())to allow creating a new reserve.
Returns Ok(()) on success, or an error if the operation fails.
§fn decrease_balance_on_hold(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
precision: Precision,
) -> Result<Self::Balance, DispatchError>
fn decrease_balance_on_hold( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, ) -> Result<Self::Balance, DispatchError>
§fn increase_balance_on_hold(
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
precision: Precision,
) -> Result<Self::Balance, DispatchError>
fn increase_balance_on_hold( reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, ) -> Result<Self::Balance, DispatchError>
Source§impl<T: Config<I>, I: 'static> WhitelistedStorageKeys for Pallet<T, I>
impl<T: Config<I>, I: 'static> WhitelistedStorageKeys for Pallet<T, I>
Source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey> indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.Source§impl<T: Config<I>, I: 'static> XpErrorHandler for Pallet<T, I>
impl<T: Config<I>, I: 'static> XpErrorHandler for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> XpLock for Pallet<T, I>
Implementation of the XpLock trait for the XP pallet.
impl<T: Config<I>, I: 'static> XpLock for Pallet<T, I>
Implementation of the XpLock trait for the XP pallet.
This provides the interface for issuing, managing, and burning XP locks, as well as querying lock state. All methods are implemented in terms of the pallet’s storage items and types.
Source§type Lock = IdXp<<T as Config<I>>::LockReason, <T as Config<I>>::Xp>
type Lock = IdXp<<T as Config<I>>::LockReason, <T as Config<I>>::Xp>
The structure representing lock metadata (reason and locked XP amount).
Source§type LockReason = <T as Config<I>>::LockReason
type LockReason = <T as Config<I>>::LockReason
The lock reason identifier used to categorize locked XP points.
Source§fn has_lock(key: &Self::XpKey) -> DispatchResult
fn has_lock(key: &Self::XpKey) -> DispatchResult
Checks if the given XP key has at least one active lock.
This function verifies that the XP key has one or more active locks by checking if the locks vector is non-empty.
§Returns
Ok(())if the XP key has at least one active lockErr(DispatchError)if no locks exist for the XP key
Source§fn lock_exists(key: &Self::XpKey, reason: &Self::LockReason) -> DispatchResult
fn lock_exists(key: &Self::XpKey, reason: &Self::LockReason) -> DispatchResult
Checks if a lock exists for the given XP key and lock reason.
§Returns
Ok(())if the lock exists for the given key and reasonErr(DispatchError)if the lock does not exist
Source§fn get_lock_xp(
key: &Self::XpKey,
reason: &Self::LockReason,
) -> Result<Self::Points, DispatchError>
fn get_lock_xp( key: &Self::XpKey, reason: &Self::LockReason, ) -> Result<Self::Points, DispatchError>
Retrieves the XP points locked under the specified lock reason.
This function returns the amount of XP points currently locked for a specific reason on the given XP key.
§Returns
Ok(Points)containing the locked XP points if foundErr(DispatchError)if the XP key or lock reason does not exist
Source§fn total_locked(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
fn total_locked(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
Retrieves the total XP points actively locked for the given key.
This function returns the sum of all locked XP across all lock reasons for the specified XP key.
§Returns
Ok(Points)containing the total locked XP points if foundErr(DispatchError)if the XP key does not exist
Source§fn get_all_locks(
key: &Self::XpKey,
) -> Result<Vec<Self::LockReason>, DispatchError>
fn get_all_locks( key: &Self::XpKey, ) -> Result<Vec<Self::LockReason>, DispatchError>
Retrieves all active lock reasons associated with the XP key.
This function returns a list of all lock reason identifiers currently active for the specified XP key.
§Returns
Ok(Vec<Self::LockReason>)containing all active lock reasons- Empty vector if no locks exist for the XP key
Source§fn burn_lock(key: &Self::XpKey, reason: &Self::LockReason) -> DispatchResult
fn burn_lock(key: &Self::XpKey, reason: &Self::LockReason) -> DispatchResult
Burns a lock and permanently removes the associated XP.
This function removes both the lock entry and destroys the locked XP points. Used in scenarios like forfeiture, decay, or permanent commitment where the XP should be permanently removed from circulation.
§Returns
Ok(())if the lock was successfully burnedErr(DispatchError)for the respected error.
Source§fn set_lock(
key: &Self::XpKey,
reason: &Self::LockReason,
points: Self::Points,
) -> DispatchResult
fn set_lock( key: &Self::XpKey, reason: &Self::LockReason, points: Self::Points, ) -> DispatchResult
Forcefully sets the locked XP for a specific lock reason.
This function bypasses typical XP flow and permission checks, directly modifying lock state without enforcing invariants.
Creates a new lock if none exists for the given reason, or updates an existing lock.
Use with caution as this is intended for internal runtime operations such as migrations, resets, or exceptional administrative flows.
§Returns
Ok(())if the lock was successfully setErr(DispatchError)if operation fails due to overflow or other constraints
Source§fn on_lock_update(
key: &Self::XpKey,
reason: &Self::LockReason,
lock_points: Self::Points,
)
fn on_lock_update( key: &Self::XpKey, reason: &Self::LockReason, lock_points: Self::Points, )
Hook invoked after a new XP lock is successfully created or mutated.
Emits an XpLock event with the XP key, lock reason, and
lock points if Config::EmitEvents is true.
- Calls the Listener
XpLockListener::lock_updated
Source§fn on_lock_burn(key: &Self::XpKey, reason: &Self::LockReason)
fn on_lock_burn(key: &Self::XpKey, reason: &Self::LockReason)
Hook invoked after an XP lock is burned and permanently removed.
Emits an XpLockBurn event with the XP key and lock reason
if Config::EmitEvents is true.
- Calls the Listener
XpLockListener::lock_burned
Source§fn on_lock_slash(
key: &Self::XpKey,
reason: &Self::LockReason,
slashed_points: Self::Points,
)
fn on_lock_slash( key: &Self::XpKey, reason: &Self::LockReason, slashed_points: Self::Points, )
Hook invoked after locked XP points are slashed.
Emits an XpLockSlash event with the XP key, lock reason,
and slashed points if Config::EmitEvents is true.
- Calls the listener
XpLockListener::lock_slashed
Source§fn can_lock_xp(
key: &Self::XpKey,
points: Self::Points,
) -> Result<(), DispatchError>
fn can_lock_xp( key: &Self::XpKey, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn can_lock_mutate(
key: &Self::XpKey,
reason: &Self::LockReason,
points: Self::Points,
) -> Result<(), DispatchError>
fn can_lock_mutate( key: &Self::XpKey, reason: &Self::LockReason, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn can_lock_new(
key: &Self::XpKey,
points: Self::Points,
) -> Result<(), DispatchError>
fn can_lock_new( key: &Self::XpKey, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn maximum_locks() -> usize
fn maximum_locks() -> usize
Source§fn lock_xp(
key: &Self::XpKey,
reason: &Self::LockReason,
points: Self::Points,
) -> Result<(), DispatchError>
fn lock_xp( key: &Self::XpKey, reason: &Self::LockReason, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn withdraw_lock(
key: &Self::XpKey,
reason: &Self::LockReason,
) -> Result<(), DispatchError>
fn withdraw_lock( key: &Self::XpKey, reason: &Self::LockReason, ) -> Result<(), DispatchError>
Source§fn slash_lock(
key: &Self::XpKey,
reason: &Self::LockReason,
points: Self::Points,
) -> Result<Self::Points, DispatchError>
fn slash_lock( key: &Self::XpKey, reason: &Self::LockReason, points: Self::Points, ) -> Result<Self::Points, DispatchError>
Source§impl<T: Config<I>, I: 'static> XpMutate for Pallet<T, I>
Implementation of the XpMutate trait for the XP pallet.
impl<T: Config<I>, I: 'static> XpMutate for Pallet<T, I>
Implementation of the XpMutate trait for the XP pallet.
This provides the interface for mutating XP entries, including creation, earning (with reputation effects), direct setting, and lifecycle hooks for XP changes.
All methods are implemented in terms of the pallet’s storage items and types.
Source§fn init_xp() -> Self::Points
fn init_xp() -> Self::Points
Returns the configured initial XP value for new entries.
This value is retrieved from runtime storage (InitXp) and is used
during Self::create_xp to initialize newly created XP records.
Source§fn new_xp(owner: &Self::Owner, key: &Self::XpKey)
fn new_xp(owner: &Self::Owner, key: &Self::XpKey)
Creates and initializes a new XP entry for the given key and owner.
Use with caution! as this bypasses typical XP flow and permission checks. Overwrites any existing XP entry without validation.
For absolute safety, utilize frame_suite::xp::BeginXp::begin_xp
Source§fn set_xp(key: &Self::XpKey, points: Self::Points) -> DispatchResult
fn set_xp(key: &Self::XpKey, points: Self::Points) -> DispatchResult
Use with caution! This function bypasses typical XP flow and permission checks.
Directly sets the liquid XP (free) for the given key.
Unlike Self::earn_xp, this method does not compute or validate the
provided points. It simply overwrites the current liquid XP value.
Intended for low-level runtime intents (e.g., migrations or internal resets).
§Returns
Ok(())if the XP was successfully setErr(DispatchError)if the XP entry does not exist
Source§fn earn_xp(
key: &Self::XpKey,
points: Self::Points,
) -> Result<Self::Points, DispatchError>
fn earn_xp( key: &Self::XpKey, points: Self::Points, ) -> Result<Self::Points, DispatchError>
Increments the liquid XP of a given key, applying pulse-based reputation mechanics.
This function is the primary entry point for awarding XP from user-driven runtime actions such as task completion, participation events, or other domain-specific intents.
Instead of directly crediting raw XP on every call, this method integrates a pulse-based reputation system that:
- Prevents inflation from repeated calls within the same block
- Gradually builds reputation (pulse) before scaling XP rewards
- Multiplies earned XP once sufficient reputation is achieved
- Provides accelerated reputation growth for locked (committed/staked) accounts
§Core Mechanics
-
Same-block protection
- If XP is earned multiple times within the same block and the pulse is already above the minimum threshold, only raw XP is added.
- Pulse is intentionally NOT incremented to discourage rapid intra-block spamming.
-
Pulse warm-up phase
- If the pulse reputation is below
MinPulse, XP is not granted yet. - Instead, the pulse accumulator is incremented, encouraging consistent long-term participation rather than burst activity.
- If the pulse reputation is below
-
Scaled XP phase
- Once
MinPulseis reached, earned XP is multiplied by the current pulse value, rewarding reputable accounts with higher returns.
- Once
-
Lock-based acceleration
- If a lock exists on the XP key (e.g., staking or commitment), the pulse is incremented again to accelerate future reputation growth.
§Note
MinPulse is dynamic-storage value to support a live, gamified XP economy.
As the ecosystem evolves, the required reputation tier can be
adjusted to maintain fair progression, prevent early-stage farming,
and keep long-term engagement meaningful without resetting user progress.
§Returns
Ok(Points)containing the actual XP credited after pulse scalingErr(DispatchError)if computation or storage mutation fails
Source§fn quote_earn_xp(
key: &Self::XpKey,
points: Self::Points,
) -> Result<Self::Points, DispatchError>
fn quote_earn_xp( key: &Self::XpKey, points: Self::Points, ) -> Result<Self::Points, DispatchError>
Determines the effective XP that would be earned for a given key, applying pulse-based reputation mechanics.
This method mirrors the logic of XpMutate::earn_xp but does not mutate state.
§Returns
Ok(Points)containing the actual XP that would be credited after pulse scalingErr(DispatchError)if computation fails or the XP key does not exist
Source§fn on_xp_update(key: &Self::XpKey, points: Self::Points)
fn on_xp_update(key: &Self::XpKey, points: Self::Points)
Hook invoked after an XP entry is updated reflecting currently available XP Points.
Emits an Xp event with the XP key and liquid points if
Config::EmitEvents is true.
- Calls the Listener
XpMutateListener::xp_updated
Source§fn on_xp_earn(key: &Self::XpKey, points: Self::Points)
fn on_xp_earn(key: &Self::XpKey, points: Self::Points)
Hook invoked after a XP is earned.
Emits an XpEarn event with the XP key and earned points if
Config::EmitEvents is true.
- Calls the Listener
XpMutateListener::xp_earned
Source§fn on_xp_create(key: &Self::XpKey, owner: &Self::Owner)
fn on_xp_create(key: &Self::XpKey, owner: &Self::Owner)
Hook invoked after a new XP entry is created.
Emits an XpCreate event with the XP key and owner if
Config::EmitEvents is true.
- Calls the listener
XpMutateListener::xp_created
Source§fn on_xp_slash(key: &Self::XpKey, slashed_points: Self::Points)
fn on_xp_slash(key: &Self::XpKey, slashed_points: Self::Points)
Hook invoked after XP points are slashed.
Emits an XpSlash event with the XP key and slashed points if
Config::EmitEvents is true.
- Calls the listener
XpMutateListener::xp_slashed
Source§fn create_xp(
owner: &Self::Owner,
key: &Self::XpKey,
) -> Result<(), DispatchError>
fn create_xp( owner: &Self::Owner, key: &Self::XpKey, ) -> Result<(), DispatchError>
Source§impl<T: Config<I>, I: 'static> XpOwner for Pallet<T, I>
Implementation of the XpOwner trait for the XP pallet.
impl<T: Config<I>, I: 'static> XpOwner for Pallet<T, I>
Implementation of the XpOwner trait for the XP pallet.
This provides the interface for XP ownership and access control, including checking ownership, enumerating all XP keys owned by an account, transferring ownership, and emitting ownership events.
All methods are implemented in terms of the pallet’s storage items and types.
Source§type Owner = <T as Config>::AccountId
type Owner = <T as Config>::AccountId
The account ID type representing the owner of an XP entry.
Source§fn xp_of_owner(owner: &Self::Owner) -> Result<Vec<Self::XpKey>, DispatchError>
fn xp_of_owner(owner: &Self::Owner) -> Result<Vec<Self::XpKey>, DispatchError>
Retrieves all XP keys currently owned by the given owner.
§Returns
Ok(Vec<XpKey>)containing all valid XP keys owned by the accountErr(DispatchError)if there are issues accessing storage
Source§fn set_owner(
owner: &Self::Owner,
key: &Self::XpKey,
new_owner: &Self::Owner,
) -> DispatchResult
fn set_owner( owner: &Self::Owner, key: &Self::XpKey, new_owner: &Self::Owner, ) -> DispatchResult
Sets the owner of the given XP key.
§Note
This is a low-level primitive that directly mutates storage without performing access control checks.
It should generally only be used internally. Prefer higher-level
APIs such as Self::transfer_owner for safe ownership transitions.
§Returns
Ok(())if the owner is successfully updatedErr(DispatchError)if the operation fails
Source§fn xp_key_gen(
owner: &Self::Owner,
xp: &Self::Xp,
) -> Result<Self::XpKey, DispatchError>
fn xp_key_gen( owner: &Self::Owner, xp: &Self::Xp, ) -> Result<Self::XpKey, DispatchError>
Generates a deterministic XP key from the provided owner and XP data.
This function creates a unique XP key using the owner’s account ID, the XP struct, and the owner’s current nonce as salt to ensure uniqueness and prevent collisions. The key generation is deterministic for the same inputs and state-variables.
§Returns
Ok(XpKey)containing the generated XP key if successfulErr(DispatchError)if the key generation process fails
Source§fn on_xp_transfer(key: &Self::XpKey, new_owner: &Self::Owner)
fn on_xp_transfer(key: &Self::XpKey, new_owner: &Self::Owner)
Hook invoked after a successful XP ownership transfer.
Emits an XpOwner event with the new owner and XP key.
Source§impl<T: Config<I>, I: 'static> XpReap for Pallet<T, I>
Implementation of the XpReap trait for the XP pallet.
impl<T: Config<I>, I: 'static> XpReap for Pallet<T, I>
Implementation of the XpReap trait for the XP pallet.
This provides the interface for finalizing (reaping) XP entries, checking reaped status, and emitting reaping events. All methods are implemented in terms of the pallet’s storage items and types.
Source§fn reap_xp(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
fn reap_xp(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
Reaps the given XP key, removing all associated data from storage.
This irreversibly deletes the XP entry from XpOf and ReservedXpOf,
and marks the key in ReapedXp to prevent accidental recreation.
Returns the total usable (liquid + reserved) XP points, which may be imprecise in edge cases involving overflow or ignored dust, since the system does not track total issuance.
Reaping forcibly removes reserves regardless of their presence.
§Returns
Ok(Points)containing the total usable (liquid + reserved) XP points that were reaped, which may be imprecise in edge cases involving overflow or ignored dust, since the system does not track total issuance.Err(DispatchError)if XP locks exist or the entry does not exist
Source§fn is_reaped(key: &Self::XpKey) -> DispatchResult
fn is_reaped(key: &Self::XpKey) -> DispatchResult
Checks if the given XP key has been reaped.
Used as a guard against accidental recreation or mutation of finalized XP entries.
§Returns
Ok(())if the XP key has been reapedErr(DispatchError)if the XP key has not been reaped
Source§fn on_xp_reap(key: &Self::XpKey)
fn on_xp_reap(key: &Self::XpKey)
Hook invoked after an XP entry has been reaped.
- Emits an
XpReapevent with the reaped XP key ifConfig::EmitEventsistrue. - Calls the Listener
XpReapListener::xp_reaped
Source§impl<T: Config<I>, I: 'static> XpReserve for Pallet<T, I>
Implementation of the XpReserve trait for the XP pallet.
impl<T: Config<I>, I: 'static> XpReserve for Pallet<T, I>
Implementation of the XpReserve trait for the XP pallet.
This provides the interface for managing XP reserves, including creation, mutation, querying, and event emission for reserved XP. All methods are implemented in terms of the pallet’s storage items and types.
Source§type Reserve = IdXp<<T as Config<I>>::ReserveReason, <T as Config<I>>::Xp>
type Reserve = IdXp<<T as Config<I>>::ReserveReason, <T as Config<I>>::Xp>
The structure representing reserve metadata (reason and reserved XP amount).
Source§type ReserveReason = <T as Config<I>>::ReserveReason
type ReserveReason = <T as Config<I>>::ReserveReason
The lock reason identifier used to categorize locked XP points.
Source§fn reserve_exists(
key: &Self::XpKey,
reason: &Self::ReserveReason,
) -> DispatchResult
fn reserve_exists( key: &Self::XpKey, reason: &Self::ReserveReason, ) -> DispatchResult
Checks if a reserve exists for the given XP key and reserve reason.
§Returns
Ok(())if the reserve exists for the given key and reasonErr(DispatchError)if the reserve does not exist
Source§fn get_reserve_xp(
key: &Self::XpKey,
reason: &Self::ReserveReason,
) -> Result<Self::Points, DispatchError>
fn get_reserve_xp( key: &Self::XpKey, reason: &Self::ReserveReason, ) -> Result<Self::Points, DispatchError>
Retrieves the XP points reserved under the specified reserve reason.
This function returns the amount of XP points currently reserved for a specific reason on the given XP key.
§Returns
Ok(Points)containing the reserved XP points if foundErr(DispatchError)if the XP key or reserve reason does not exist
Source§fn total_reserved(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
fn total_reserved(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
Retrieves the total XP points actively reserved for the given key.
This function returns the sum of all reserved XP across all reserve reasons for the specified XP key.
§Returns
Ok(Points)containing the total reserved XP points if foundErr(DispatchError)if the XP key does not exist
Source§fn has_reserve(key: &Self::XpKey) -> DispatchResult
fn has_reserve(key: &Self::XpKey) -> DispatchResult
Checks if the given XP key has at least one active reserve.
This function verifies that the XP key has one or more active reserves by checking if the reserves vector is non-empty.
§Returns
Ok(())if the XP key has at least one active reserveErr(DispatchError)if no reserves exist for the XP key
Source§fn get_all_reserves(
key: &Self::XpKey,
) -> Result<Vec<Self::ReserveReason>, DispatchError>
fn get_all_reserves( key: &Self::XpKey, ) -> Result<Vec<Self::ReserveReason>, DispatchError>
Retrieves all active reserve reasons associated with the XP key.
This function returns a list of all reserve reason identifiers currently active for the specified XP key.
§Returns
Ok(Vec<Self::ReserveReason>)containing all active reserve reasons- Empty vector if no reserves exist for the XP key
Source§fn set_reserve(
key: &Self::XpKey,
reason: &Self::ReserveReason,
points: Self::Points,
) -> DispatchResult
fn set_reserve( key: &Self::XpKey, reason: &Self::ReserveReason, points: Self::Points, ) -> DispatchResult
Forcefully sets the reserved XP for a specific reserve reason.
This function bypasses typical XP flow and permission checks, directly modifying reserve state without enforcing invariants.
Creates a new reserve if none exists for the given reason, or updates an existing reserve.
Use with caution as this is intended for internal runtime operations such as migrations, resets, or exceptional administrative flows.
§Returns
Ok(())if the reserve was successfully setErr(DispatchError)if operation fails due to overflow or other constraints
Source§fn on_reserve_update(
key: &Self::XpKey,
reason: &Self::ReserveReason,
reserve_points: Self::Points,
)
fn on_reserve_update( key: &Self::XpKey, reason: &Self::ReserveReason, reserve_points: Self::Points, )
Hook invoked after a new reservation is created or mutated.
Emits an XpReserve event with the XP key, reserve reason,
and reserve points if Config::EmitEvents is true.
- Calls the Listener
XpReserveListener::reserve_updated
Source§fn on_reserve_slash(
key: &Self::XpKey,
reason: &Self::ReserveReason,
slashed_points: Self::Points,
)
fn on_reserve_slash( key: &Self::XpKey, reason: &Self::ReserveReason, slashed_points: Self::Points, )
Hook invoked after reserved XP points are slashed.
Emits an XpReserveSlash event with the XP key, reserve reason,
and slashed points if Config::EmitEvents is true.
- Calls the listener
XpReserveListener::reserve_slashed
Source§fn can_reserve_xp(
key: &Self::XpKey,
points: Self::Points,
) -> Result<(), DispatchError>
fn can_reserve_xp( key: &Self::XpKey, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn can_reserve_mutate(
key: &Self::XpKey,
reason: &Self::ReserveReason,
points: Self::Points,
) -> Result<(), DispatchError>
fn can_reserve_mutate( key: &Self::XpKey, reason: &Self::ReserveReason, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn can_reserve_new(
key: &Self::XpKey,
points: Self::Points,
) -> Result<(), DispatchError>
fn can_reserve_new( key: &Self::XpKey, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn maximum_reserves() -> usize
fn maximum_reserves() -> usize
Source§fn reserve_xp(
key: &Self::XpKey,
reason: &Self::ReserveReason,
points: Self::Points,
) -> Result<(), DispatchError>
fn reserve_xp( key: &Self::XpKey, reason: &Self::ReserveReason, points: Self::Points, ) -> Result<(), DispatchError>
Source§fn withdraw_reserve(
key: &Self::XpKey,
reason: &Self::ReserveReason,
) -> Result<(), DispatchError>
fn withdraw_reserve( key: &Self::XpKey, reason: &Self::ReserveReason, ) -> Result<(), DispatchError>
Source§fn reset_reserve(
key: &Self::XpKey,
reason: &Self::ReserveReason,
) -> Result<Self::Points, DispatchError>
fn reset_reserve( key: &Self::XpKey, reason: &Self::ReserveReason, ) -> Result<Self::Points, DispatchError>
Source§fn slash_reserve(
key: &Self::XpKey,
reason: &Self::ReserveReason,
points: Self::Points,
) -> Result<Self::Points, DispatchError>
fn slash_reserve( key: &Self::XpKey, reason: &Self::ReserveReason, points: Self::Points, ) -> Result<Self::Points, DispatchError>
Source§fn withdraw_reserve_partial(
key: &Self::XpKey,
reason: &Self::ReserveReason,
points: Self::Points,
precision: Precision,
) -> Result<(), DispatchError>
fn withdraw_reserve_partial( key: &Self::XpKey, reason: &Self::ReserveReason, points: Self::Points, precision: Precision, ) -> Result<(), DispatchError>
Source§impl<T: Config<I>, I: 'static> XpSystem for Pallet<T, I>
Implementation of the XpSystem trait for the XP pallet.
impl<T: Config<I>, I: 'static> XpSystem for Pallet<T, I>
Implementation of the XpSystem trait for the XP pallet.
This provides the core, read-only interface for querying XP state, metadata, and key management. All methods are implemented in terms of the pallet’s storage items and types.
Source§type Xp = Xp<T, I>
type Xp = Xp<T, I>
The primary data structure for XP accounts in this pallet.
It encapsulates all metadata information for an XP entry, including liquid, reserved, and locked XP, as well as reputation pulse and timestamp.
Source§type Points = <T as Config<I>>::Xp
type Points = <T as Config<I>>::Xp
The scalar type representing XP points (the main XP balance unit).
Source§type XpKey = <T as Config>::AccountId
type XpKey = <T as Config>::AccountId
The unique key type for XP entries (distinct from the owner).
Same as [frame_system::Config::AccountId]
Source§type TimeStamp = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
type TimeStamp = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
The type representing the timestamp (block number) for XP lifecycle tracking.
Source§type Extension = <T as Config<I>>::Extensions
type Extension = <T as Config<I>>::Extensions
Pallet Extensions includes external listeners and their triggers.
Source§fn xp_exists(key: &Self::XpKey) -> DispatchResult
fn xp_exists(key: &Self::XpKey) -> DispatchResult
Checks if an XP entry exists for the given key.
This function verifies the existence of an XP entry in storage by checking
if the provided key exists in the XpOf storage map.
§Returns
Ok(())if the XP entry exists for the given keyErr(DispatchError)if the entry does not exist
Source§fn get_xp(key: &Self::XpKey) -> Result<Self::Xp, DispatchError>
fn get_xp(key: &Self::XpKey) -> Result<Self::Xp, DispatchError>
Retrieves the complete XP struct for the given key.
This function fetches the full XP data structure from storage, containing all metadata including liquid, reserved, locked XP, reputation pulse, and timestamp.
§Returns
Ok(Xp)containing the complete XP struct if foundErr(DispatchError)if the entry does not exist
Source§fn has_minimum_xp(key: &Self::XpKey) -> DispatchResult
fn has_minimum_xp(key: &Self::XpKey) -> DispatchResult
Validates if the XP entry meets the minimum timestamp threshold.
This function checks whether an XP entry’s timestamp satisfies the minimum timestamp requirement, which is used for XP liveness validation and reaping logic.
§Returns
Ok(())if the XP entry meets the minimum timestamp thresholdErr(DispatchError)if the timestamp is below the minimum
Source§fn get_liquid_xp(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
fn get_liquid_xp(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
Retrieves the liquid (free) XP balance for the given key.
This function returns liquid XP points, which represents the freely spendable XP balance that is not reserved or locked for any specific purpose.
§Returns
Ok(Points)containing the liquid XP balance if foundErr(DispatchError)if the entry does not exist
Source§fn get_usable_xp(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
fn get_usable_xp(key: &Self::XpKey) -> Result<Self::Points, DispatchError>
Retrieves the total usable XP (liquid + reserved) for the given key.
This function calculates and returns the sum of liquid and reserved XP, representing the total amount of XP that can be utilized by the account. Locked XP is excluded as it cannot be spent or transferred.
§Returns
Ok(Points)containing the total usable XP balance if foundErr(DispatchError)if the entry does not exist
impl<T, I> Eq for Pallet<T, I>
Auto Trait Implementations§
impl<T, I> Freeze for Pallet<T, I>
impl<T, I> RefUnwindSafe for Pallet<T, I>where
T: RefUnwindSafe,
I: RefUnwindSafe,
impl<T, I> Send for Pallet<T, I>
impl<T, I> Sync for Pallet<T, I>
impl<T, I> Unpin for Pallet<T, I>
impl<T, I> UnwindSafe for Pallet<T, I>where
T: UnwindSafe,
I: 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<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 = "routine"
const FALLBACK_TARGET: &'static 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<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
fn info(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
Source§fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> 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.