pub trait Config<I: 'static = ()>: Config {
Show 15 associated items
type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as Config>::RuntimeEvent>;
type AssetHold: From<HoldReason> + RuntimeEnum + Delimited + Copy + VariantCount;
type AssetFreeze: From<FreezeReason> + RuntimeEnum + Delimited + Copy + VariantCount;
type Shares: Countable + Into<AssetOf<Self, I>> + MaybeDisplay;
type Bias: Fractional;
type Time: Time;
type Commission: Percentage;
type Asset: Inspect<Proprietor<Self>, Balance: MaybeDisplay + From<<Self::Bias as FixedPointNumber>::Inner> + From<<Self::Commission as PerThing>::Inner>> + InspectFreeze<Proprietor<Self>, Id = Self::AssetFreeze> + InspectHold<Proprietor<Self>, Reason = Self::AssetHold> + Mutate<Proprietor<Self>> + UnbalancedHold<Proprietor<Self>> + Unbalanced<Proprietor<Self>> + MutateHold<Proprietor<Self>> + MutateFreeze<Proprietor<Self>>;
type Position: PositionIndex + RuntimeEnum + Delimited + Default;
type BalanceFamily<'a>: LazyBalanceRoot<LazyInput<'a, Self, I>, <Self::BalanceContext as ModelContext>::Context, LazyOutput<'a, Self, I>>;
type BalanceContext: ModelContext<Context: LazyBalanceContext>;
type WeightInfo: WeightInfo;
type MaxIndexEntries: Get<u32> + Clone + Debug;
type MaxCommits: Get<u32> + Clone + Debug;
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 Commitment 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 = Staking,Governance, etc. -> multiple independent instances
Required Associated Types§
Sourcetype RuntimeEvent: From<Event<Self, I>> + IsType<<Self as Config>::RuntimeEvent>
type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as Config>::RuntimeEvent>
The overarching event type for the runtime.
Sourcetype AssetHold: From<HoldReason> + RuntimeEnum + Delimited + Copy + VariantCount
type AssetHold: From<HoldReason> + RuntimeEnum + Delimited + Copy + VariantCount
Hold reason type for locking assets.
Utilized to provide a native hold reason for all commitments.
Sourcetype AssetFreeze: From<FreezeReason> + RuntimeEnum + Delimited + Copy + VariantCount
type AssetFreeze: From<FreezeReason> + RuntimeEnum + Delimited + Copy + VariantCount
Freeze reason type for commitment-specific freezes.
Type for representing shares in indexes or pools.
Must implement an unsigned integer and be convertible into the pallet’s asset type (safe conversion).
Sourcetype Bias: Fractional
type Bias: Fractional
Bias factor used for fixed-point arithmetic for direct, index, or pool commitments.
Must be a fixed-point number whose precision is sufficient to safely handle division and percentage-based arithmetic operations.
Sourcetype Time: Time
type Time: Time
Time counter used for timestamps.
May be block number, Unix epoch, or an internal counter.
Sourcetype Commission: Percentage
type Commission: Percentage
Commission type used for pool fee calculations.
Represents a percentage or ratio value applied during pool resolution to extract commission from committed value.
Sourcetype Asset: Inspect<Proprietor<Self>, Balance: MaybeDisplay + From<<Self::Bias as FixedPointNumber>::Inner> + From<<Self::Commission as PerThing>::Inner>> + InspectFreeze<Proprietor<Self>, Id = Self::AssetFreeze> + InspectHold<Proprietor<Self>, Reason = Self::AssetHold> + Mutate<Proprietor<Self>> + UnbalancedHold<Proprietor<Self>> + Unbalanced<Proprietor<Self>> + MutateHold<Proprietor<Self>> + MutateFreeze<Proprietor<Self>>
type Asset: Inspect<Proprietor<Self>, Balance: MaybeDisplay + From<<Self::Bias as FixedPointNumber>::Inner> + From<<Self::Commission as PerThing>::Inner>> + InspectFreeze<Proprietor<Self>, Id = Self::AssetFreeze> + InspectHold<Proprietor<Self>, Reason = Self::AssetHold> + Mutate<Proprietor<Self>> + UnbalancedHold<Proprietor<Self>> + Unbalanced<Proprietor<Self>> + MutateHold<Proprietor<Self>> + MutateFreeze<Proprietor<Self>>
The fungible asset type for this pallet instance.
Must support inspection and unbalanced mutation, freezing, and holding operations.
Sourcetype Position: PositionIndex + RuntimeEnum + Delimited + Default
type Position: PositionIndex + RuntimeEnum + Delimited + Default
The set of commitment dispositions supported by this pallet.
A disposition acts as a meta-identifier defining the semantic position of a commitment (e.g. affirmative, contrary). Commitments are scoped by this value.
For plain commitments where no variant is explicitly specified, the
Default value of this type is used.
Implementations must ensure that only semantic variants participate
in indexing; marker or non-semantic variants should be excluded in
PositionIndex.
The Ignore type may be used to represent a
single, non-variant position. In this configuration, all commitments map
to index 0, effectively disabling variant-based semantics.
For optimal storage usage, it is recommended that the default variant
maps to index 0, allowing non-varianted commitments to occupy the
first slot without requiring initialization of higher variant slots.
Sourcetype BalanceFamily<'a>: LazyBalanceRoot<LazyInput<'a, Self, I>, <Self::BalanceContext as ModelContext>::Context, LazyOutput<'a, Self, I>>
type BalanceFamily<'a>: LazyBalanceRoot<LazyInput<'a, Self, I>, <Self::BalanceContext as ModelContext>::Context, LazyOutput<'a, Self, I>>
The Lazy balance
plugin family anchor type.
Encapsulates all lazy balance operations including validation, mutation, resolution, and query semantics over commitments, indexes, and pools.
Each operation is selected via a discriminant defined in
LazyBalanceRoot and executed using LazyInput -> LazyOutput
transformation.
Conceptually performs:
Operation(LazyInput) -> LazyOutput
where the specific behavior is determined by the plugin model associated with each operation discriminant.
Designed to be selectable using template plugin family models in
frame_plugins::balances or custom model defining
macros via frame_suite::plugins.
§Pool Constraints
Pool operations via CommitPool represent higher-order balance
compositions (balance over balance), and therefore impose stricter
requirements.
These operations rely on [Directive] semantics, where:
- [
Precision::Exact] must be honored for correct value distribution - [
Fortitude::Force] must be enforced for deterministic execution
These guarantees are essential for correctness of pool allocation, redistribution, and resolution.
If Config::MaxIndexEntries is set to 0, index and pool
commitments are disabled, and these requirements do not apply.
When pools are enabled, plugin models must correctly support these semantics, otherwise operations may fail internally.
Sourcetype BalanceContext: ModelContext<Context: LazyBalanceContext>
type BalanceContext: ModelContext<Context: LazyBalanceContext>
Plugin family context for lazy balance execution.
Supplies the execution environment required by
Self::BalanceFamily for all operations over
LazyInput -> LazyOutput.
Defines bounds, extension schemas, and unified error handling, ensuring consistent and type-safe execution across all operations.
Must produce a context satisfying LazyBalanceContext.
Sourcetype WeightInfo: WeightInfo
type WeightInfo: WeightInfo
Weight information for extrinsics in this pallet.
Sourcetype MaxIndexEntries: Get<u32> + Clone + Debug
type MaxIndexEntries: Get<u32> + Clone + Debug
Maximum number of entries allowed in an index.
Setting this value to zero disables index and pool commitments for this pallet instance. A non-zero value enables hosting index and pool commitments;
An index represents an unmanaged pool of digests with associated shares. A single committed value to the index is proportionally distributed across its entries as individual commitments.
Since pools are constructed from indexes, this limit also bounds the maximum number of slots a pool may contain.
Sourcetype MaxCommits: Get<u32> + Clone + Debug
type MaxCommits: Get<u32> + Clone + Debug
Maximum number of commitments allowed per digest.
Should be a Non-Zero Value, else unstable behaviours should be expected.
Each commitment represents an individual lock against a digest. A digest may therefore have at most this many active commitments.
This limit applies uniformly, regardless of whether commitments originate directly, from an index, or from a pool. Commitments distributed from an index or pool still count as individual commitments to the underlying digest.
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.