pub trait Config: Config {
    type PalletId: Get<PalletId>;
    type RuntimeCall: Parameter + Dispatchable<RuntimeOrigin = Self::RuntimeOrigin> + GetDispatchInfo + From<Call<Self>>;
    type Currency: ReservableCurrency<Self::AccountId>;
    type Randomness: Randomness<Self::Hash, BlockNumberFor<Self>>;
    type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>;
    type ManagerOrigin: EnsureOrigin<Self::RuntimeOrigin>;
    type MaxCalls: Get<u32>;
    type ValidateCall: ValidateCall<Self>;
    type MaxGenerateRandom: Get<u32>;
    type WeightInfo: WeightInfo;
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. The pallet’s config trait.

Required Associated Types§


type PalletId: Get<PalletId>

The Lottery’s pallet id


type RuntimeCall: Parameter + Dispatchable<RuntimeOrigin = Self::RuntimeOrigin> + GetDispatchInfo + From<Call<Self>>

A dispatchable call.


type Currency: ReservableCurrency<Self::AccountId>

The currency trait.


type Randomness: Randomness<Self::Hash, BlockNumberFor<Self>>

Something that provides randomness in the runtime.


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

The overarching event type.


type ManagerOrigin: EnsureOrigin<Self::RuntimeOrigin>

The manager origin.


type MaxCalls: Get<u32>

The max number of calls available in a single lottery.


type ValidateCall: ValidateCall<Self>

Used to determine if a call would be valid for purchasing a ticket.

Be conscious of the implementation used here. We assume at worst that a vector of MaxCalls indices are queried for any call validation. You may need to provide a custom benchmark if this assumption is broken.


type MaxGenerateRandom: Get<u32>

Number of time we should try to generate a random number that has no modulo bias. The larger this number, the more potential computation is used for picking the winner, but also the more likely that the chosen winner is done fairly.


type WeightInfo: WeightInfo

Weight information for extrinsics in this pallet.

Object Safety§

This trait is not object safe.