Oracle
Parallel oracle implement with
orml-oracle
, serval approved members can feed prices to on-chain oracle, and then aggregated on-chain.
This pallet provides the price from Oracle Module by implementing the
PriceFeeder
trait. In case of emergency, the price can be set directly by Oracle Collective.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 |
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.
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.
Set emergency price. [currency_id, price_detail]
SetPrice(CurrencyId, PriceWithDecimal)
Reset emergency price. [currency_id]
ResetPrice(CurrencyId)
Last modified 22d ago