1#![no_std]
5
6#[cfg(any(test, feature = "testutils"))]
7pub mod testutils;
8
9use soroban_sdk::{contractclient, contracttype, Address, Env, Symbol, Vec};
10
11#[contracttype]
13#[derive(Clone)]
14pub struct PriceData {
15 pub price: i128,
16 pub timestamp: u64,
17}
18
19#[contracttype]
21#[derive(Clone)]
22pub enum Asset {
23 Stellar(Address),
24 Other(Symbol),
25}
26
27#[contractclient(name = "PriceFeedClient")]
29pub trait PriceFeedTrait {
30 fn base(env: Env) -> Asset;
32
33 fn assets(env: Env) -> Vec<Asset>;
35
36 fn decimals(env: Env) -> u32;
38
39 fn resolution(env: Env) -> u32;
41
42 fn price(env: Env, asset: Asset, timestamp: u64) -> Option<PriceData>;
44
45 fn prices(env: Env, asset: Asset, records: u32) -> Option<Vec<PriceData>>;
47
48 fn lastprice(env: Env, asset: Asset) -> Option<PriceData>;
50}