PriceFeedTrait

Trait PriceFeedTrait 

Source
pub trait PriceFeedTrait {
    // Required methods
    fn base(env: Env) -> Asset;
    fn assets(env: Env) -> Vec<Asset>;
    fn decimals(env: Env) -> u32;
    fn resolution(env: Env) -> u32;
    fn price(env: Env, asset: Asset, timestamp: u64) -> Option<PriceData>;
    fn prices(env: Env, asset: Asset, records: u32) -> Option<Vec<PriceData>>;
    fn lastprice(env: Env, asset: Asset) -> Option<PriceData>;
}
Expand description

Oracle feed interface description

Required Methods§

Source

fn base(env: Env) -> Asset

Return the base asset the price is reported in

Source

fn assets(env: Env) -> Vec<Asset>

Return all assets quoted by the price feed

Source

fn decimals(env: Env) -> u32

Return the number of decimals for all assets quoted by the oracle

Source

fn resolution(env: Env) -> u32

Return default tick period timeframe (in seconds)

Source

fn price(env: Env, asset: Asset, timestamp: u64) -> Option<PriceData>

Get price in base asset at specific timestamp

Source

fn prices(env: Env, asset: Asset, records: u32) -> Option<Vec<PriceData>>

Get last N price records

Source

fn lastprice(env: Env, asset: Asset) -> Option<PriceData>

Get the most recent price for an asset

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.

Implementors§