helium_api/models/oracle.rs
1use super::Usd;
2use serde::Deserialize;
3
4/// An oracle prediction is inferred from the current oracle price and submitted
5/// oracle price reports.
6#[derive(Clone, Deserialize, Debug)]
7pub struct OraclePrediction {
8 /// The oracle price at the indicated block in Usd millis
9 #[serde(deserialize_with = "Usd::deserialize")]
10 pub price: Usd,
11 /// The epoch time when the price is expected to take hold
12 pub time: u64,
13}
14
15/// An oracle price is inferred from oracle price reports on a regular basis by
16/// the blockchain. It determines the conversion rate between Hnt and Data
17/// Credits.
18#[derive(Clone, Deserialize, Debug)]
19pub struct OraclePrice {
20 /// The oracle price at the indicated block in Usd millis
21 #[serde(deserialize_with = "Usd::deserialize")]
22 pub price: Usd,
23 /// The block height the oracle price was set at
24 pub block: u64,
25}