Trait Config

Source
pub trait Config<I: 'static = ()>: Config {
    type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as Config>::RuntimeEvent>;
    type RuntimeCall: Parameter + Dispatchable<RuntimeOrigin = Self::RuntimeOrigin> + GetDispatchInfo + From<Call<Self>> + IsSubType<Call<Self, I>> + IsType<<Self as Config>::RuntimeCall>;
    type ReserveReason: RuntimeEnum + Delimited + Copy + VariantCount;
    type LockReason: RuntimeEnum + Delimited + Copy + VariantCount;
    type Xp: Asset + From<Self::Pulse>;
    type Pulse: Time;
    type WeightInfo: WeightInfo;
    type Extensions: XpSystemExtensions<Via = Pallet<Self, I>> + XpOwnerListener + XpMutateListener + XpReserveListener + XpLockListener + XpReapListener;
    type EmitEvents: Get<bool> + Clone + Debug;
}
Expand description

Configuration trait of this pallet.

The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.

Consequently, a runtime that wants to include this pallet must implement this trait. Configuration trait for the XP pallet.

This trait defines the types, constants, and dependencies that the runtime must provide for this pallet to function.

The generic parameter I allows the same pallet to be instantiated multiple times within a runtime. Each instance can have its own independent storage and configuration.

Example:

  • I = () -> default (single instance)
  • I = Core, Instance2, etc. -> multiple independent instances

Required Associated Types§

Source

type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as Config>::RuntimeEvent>

The overarching event type.

Source

type RuntimeCall: Parameter + Dispatchable<RuntimeOrigin = Self::RuntimeOrigin> + GetDispatchInfo + From<Call<Self>> + IsSubType<Call<Self, I>> + IsType<<Self as Config>::RuntimeCall>

The overarching call type.

Source

type ReserveReason: RuntimeEnum + Delimited + Copy + VariantCount

The reason type for XP reserves.

This should be a bounded, enumerable type (e.g., an enum) that classifies the context or intent for which XP is reserved (such as staking, governance, or slashing).

Source

type LockReason: RuntimeEnum + Delimited + Copy + VariantCount

The reason type for XP locks.

This should be a bounded, enumerable type (e.g., an enum) that classifies the context or intent for which XP is locked (such as staking, governance, or slashing).

Source

type Xp: Asset + From<Self::Pulse>

The XP balance type for XP accounting.

Source

type Pulse: Time

The numeric type used for pulse calculations (XP activity heartbeat i.e., reputation).

Source

type WeightInfo: WeightInfo

Weight information for extrinsics in this pallet.

Source

type Extensions: XpSystemExtensions<Via = Pallet<Self, I>> + XpOwnerListener + XpMutateListener + XpReserveListener + XpLockListener + XpReapListener

XP extensions for external integrations.

This defines extension hooks that observe XP lifecycle events.

Note:

Source

type EmitEvents: Get<bool> + Clone + Debug

Controls emission of Event via deposit_event.

Recommended:

  • false for production runtimes (to reduce overhead)
  • true for development and mock runtimes (for testing and observability)

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§