Expand description
Defines a interface for managing “Experience Points” (XP) as an abstract economic primitive or a constrained resource.
XP can serve as a non-monetary metric representing a wide range of contextual values such as reputation, skill progression, contribution points, influence weight, or any form of quantified domain-specific value.
§Experience Points (XP): A Formal Abstraction of Progress
Experience Points or XP, represent a quantifiable measure of progress, participation, or value within a system.
- Originally popularized in games to track advancement, now a known primitive for measuring engagement and achievement.
- Encodes effort, contribution, or status into a visible, programmable metric.
§Key Properties
- Non-transferable: Linked to a specific user or role, cannot be freely moved like currency.
- Earned: Collected through effort or activity, cannot be bought or arbitrarily inflated.
- Contextual: Interpreted according to the domain’s rules and objectives.
- Comparable: Can be ranked or measured, but is not fungible.
These properties make XP an economic primitive for designing systems that value engagement, merit, and progression over purely financial or fungible incentives.
§Overview
The system is composed of modular-traits that define behaviors such as:
- XP creation, mutation, and ownership
- Locking and reserving XP for runtime-intents
- Burning/slashing XP as penalties or resets
- Emitting events to reflect lifecycle changes
Implementers of this interface can define their own internal mechanics while providing a standardized API. This trait-oriented design supports flexible integration across any system that needs to quantify and govern non-monetary value.
§Use Cases
XP can be used anywhere progress, participation, or contribution needs to be measured or rewarded.
Common scenarios include:
- Governance: Reputation, voting influence, contribution tracking.
- Gaming: Player progression, unlockable content, skill-based gating.
- Workplace: Skill development, training milestones, peer recognition.
- Communities: Engagement scores, moderation trust, contributor incentives.
- Supply Chains: Performance metrics, reliability scoring, compliance history.
Enums§
- XpError
- XP-related error types.
Traits§
- BeginXp
- Blanket Trait for safe initialization and earning of XP entries.
- XpError
Handler - A trait for mapping domain-level XP errors into caller- or pallet-specific error types.
- XpLock
- Trait for issuing and managing XP locks.
- XpLock
Listener - Listener trait for XP locking events.
- XpMutate
- Trait for mutating (modifying) XP entries and providing default support utilities.
- XpMutate
Listener - Listener trait for XP mutation events.
- XpOwner
- Trait for XP ownership and access control.
- XpOwner
Listener - Listener trait for XP ownership events.
- XpReap
- Trait for XP lifecycle finalization (reaping) with built-in support utilities.
- XpReap
Listener - Listener trait for XP reaping events.
- XpReserve
- Trait for reserving XP under specific reasons with built-in support utilities.
- XpReserve
Listener - Listener trait for XP reserving events.
- XpSystem
- Core trait for querying XP state and metadata.
- XpSystem
Extensions - Root trait for XP system extensions.
Type Aliases§
- Key
- Alias for
XpSystem::XpKey - Lock
Reason - Alias for
XpLock::LockReason - Owner
- Alias for
XpOwner::Owner - Points
- Alias for
XpSystem::Points - Reserve
Reason - Alias for
XpReserve::ReserveReason