Trait hydradx_traits::oracle::AggregatedPriceOracle
source · pub trait AggregatedPriceOracle<AssetId, BlockNumber, Price> {
type Error;
fn get_price(
asset_a: AssetId,
asset_b: AssetId,
period: OraclePeriod,
source: Source
) -> Result<(Price, BlockNumber), Self::Error>;
fn get_price_weight() -> Weight;
}
Expand description
An oracle returning a price aggregated over period
with the associated oracle age (to allow
judging whether the oracle had a chance to settle yet).
Required Associated Types§
Required Methods§
fn get_price(
asset_a: AssetId,
asset_b: AssetId,
period: OraclePeriod,
source: Source
) -> Result<(Price, BlockNumber), Self::Error>
fn get_price_weight() -> Weight
Implementations on Foreign Types§
source§impl<AssetId, BlockNumber, Price> AggregatedPriceOracle<AssetId, BlockNumber, Price> for ()
impl<AssetId, BlockNumber, Price> AggregatedPriceOracle<AssetId, BlockNumber, Price> for ()
Default implementation of the oracle trait that always returns Err
.
type Error = ()
fn get_price(
_asset_a: AssetId,
_asset_b: AssetId,
_period: OraclePeriod,
_source: Source
) -> Result<(Price, BlockNumber), Self::Error>
fn get_price_weight() -> Weight
Implementors§
source§impl<AssetId, BlockNumber, Price> AggregatedPriceOracle<AssetId, BlockNumber, Price> for AlwaysPriceOfOnewhere
Price: One,
BlockNumber: One,
impl<AssetId, BlockNumber, Price> AggregatedPriceOracle<AssetId, BlockNumber, Price> for AlwaysPriceOfOnewhere
Price: One,
BlockNumber: One,
Mock implementation of the oracle trait that always returns Price::one()
and oracle age of
BlockNumber::one()
.