pub trait Config<I: 'static = ()>: Config + Config<RuntimeEvent: From<Event<Self, I>>> {
type OnNewData: OnNewData<Self::AccountId, Self::OracleKey, Self::OracleValue>;
type CombineData: CombineData<Self::OracleKey, TimestampedValue<<Self as Config<I>>::OracleValue, <<Self as Config<I>>::Time as Time>::Moment>>;
type Time: Time;
type OracleKey: Parameter + Member + MaxEncodedLen;
type OracleValue: Parameter + Member + Ord + MaxEncodedLen;
type PalletId: Get<PalletId>;
type Members: SortedMembers<Self::AccountId>;
type WeightInfo: WeightInfo;
type MaxHasDispatchedSize: Get<u32>;
type MaxFeedValues: Get<u32>;
type BenchmarkHelper: BenchmarkHelper<Self::OracleKey, Self::OracleValue, Self::MaxFeedValues>;
}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.
Required Associated Types§
Sourcetype OnNewData: OnNewData<Self::AccountId, Self::OracleKey, Self::OracleValue>
type OnNewData: OnNewData<Self::AccountId, Self::OracleKey, Self::OracleValue>
A hook to be called when new data is received.
This hook is triggered whenever an oracle operator successfully submits new data. It allows other pallets to react to oracle updates, enabling real-time responses to external data changes.
Sourcetype CombineData: CombineData<Self::OracleKey, TimestampedValue<<Self as Config<I>>::OracleValue, <<Self as Config<I>>::Time as Time>::Moment>>
type CombineData: CombineData<Self::OracleKey, TimestampedValue<<Self as Config<I>>::OracleValue, <<Self as Config<I>>::Time as Time>::Moment>>
The implementation to combine raw values into a single aggregated value.
This type defines how multiple oracle operator submissions are combined into a single trusted value. Common implementations include taking the median (to resist outliers) or weighted averages based on operator reputation.
Sourcetype Time: Time
type Time: Time
The time provider for timestamping oracle data.
This type provides the current timestamp used to mark when oracle data was submitted. Timestamps are crucial for determining data freshness and preventing stale data usage.
Sourcetype OracleKey: Parameter + Member + MaxEncodedLen
type OracleKey: Parameter + Member + MaxEncodedLen
The key type for identifying oracle data feeds.
This type is used to uniquely identify different types of oracle data (e.g., currency pairs, asset prices, weather data).
Sourcetype OracleValue: Parameter + Member + Ord + MaxEncodedLen
type OracleValue: Parameter + Member + Ord + MaxEncodedLen
The value type for oracle data.
This type represents the actual data submitted by oracle operators (e.g., prices, temperatures, scores).
Sourcetype PalletId: Get<PalletId>
type PalletId: Get<PalletId>
The pallet ID.
Will be used to derive the pallet’s account, which is used as the oracle account when values are fed by root.
Sourcetype Members: SortedMembers<Self::AccountId>
type Members: SortedMembers<Self::AccountId>
The source of oracle members.
This type provides the set of accounts authorized to submit oracle data. Typically implemented by membership pallets to allow governance-controlled management of oracle operators.
Sourcetype WeightInfo: WeightInfo
type WeightInfo: WeightInfo
Weight information for extrinsics in this pallet.
Sourcetype MaxHasDispatchedSize: Get<u32>
type MaxHasDispatchedSize: Get<u32>
The maximum number of oracle operators that can feed data in a single block.
Sourcetype MaxFeedValues: Get<u32>
type MaxFeedValues: Get<u32>
The maximum number of key-value pairs that can be submitted in a single extrinsic.
Sourcetype BenchmarkHelper: BenchmarkHelper<Self::OracleKey, Self::OracleValue, Self::MaxFeedValues>
type BenchmarkHelper: BenchmarkHelper<Self::OracleKey, Self::OracleValue, Self::MaxFeedValues>
A helper trait for benchmarking oracle operations.
Provides sample data for benchmarking the oracle pallet, allowing accurate weight calculations and performance testing.
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.