ParaX
Search
K

Oracle

Overview

Parallel oracle implement with orml-oracle , serval approved members can feed prices to on-chain oracle, and then aggregated on-chain.
Tip: follow the link for more info about orml-oracle.

Oracle Architecture

Prices Pallet

This pallet provides the price from Oracle Module by implementing thePriceFeeder trait. In case of emergency, the price can be set directly by Oracle Collective.

View Data Storage

EmergencyPrice

Mapping from currency id to it's emergency price
Code
View Method
pub type EmergencyPrice<T: Config> = StorageMap<_, Twox64Concat, CurrencyId, PriceWithDecimal, OptionQuery>;
EmergencyPrice::T::get(currency_id: &CurrencyId)
Self::emergency_price(currency_id: &CurrencyId)
Key Name
Type
Description
currency_id
CurrencyId
The currency's Id
Tip: Follow the link to know more about 'CurrencyId'.

View Methods

Set_price()

Set emergency price
pub fn set_price(origin: OriginFor<T>, currency_id: CurrencyId, price: PriceWithDecimal,) -> DispatchResultWithPostInfo
Name
Substrate Config
Runtime Type
Description
origin
T::Origin
RawOrigin
The account signed this transaction
currency_id
-
CurrencyId
The currency id price to be set
price
-
PriceWithDecimal
The price with decimal to be set
RETURN: Returns Ok() when set_price succeeds, otherwise return a substrate error type.
Tip: Follow the link to know more about 'PriceWithDecimal'.

Reset_price()

Reset emergency price
pub fn reset_price(origin: OriginFor<T>, currency_id: CurrencyId,) -> DispatchResultWithPostInfo
Name
Substrate Config
Runtime Type
Description
origin
T::Origin
RawOrigin
The account signed this transaction
currency_id
-
CurrencyId
The currency id price to be set
RETURN: Returns Ok() when reset_price succeeds, otherwise return a substrate error type.

View Event

SetPrice

Set emergency price. [currency_id, price_detail]
SetPrice(CurrencyId, PriceWithDecimal)

ResetPrice

Reset emergency price. [currency_id]
ResetPrice(CurrencyId)
Last modified 22d ago