Skip to content

Commit b7c6f9f

Browse files
authored
Merge pull request #19 from pyth-network/abehjati/format-code
Format the code
2 parents dc59959 + 3bc6210 commit b7c6f9f

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

pyth-sdk-solana/examples/eth_price.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ fn main() {
4242
let maybe_ema_price = eth_price.get_ema_price();
4343
match maybe_ema_price {
4444
Some(ema_price) => {
45-
println!("ema_price ....... {} x 10^{}", ema_price.price, ema_price.expo);
46-
println!("ema_conf ........ {} x 10^{}", ema_price.conf, ema_price.expo);
45+
println!(
46+
"ema_price ....... {} x 10^{}",
47+
ema_price.price, ema_price.expo
48+
);
49+
println!(
50+
"ema_conf ........ {} x 10^{}",
51+
ema_price.conf, ema_price.expo
52+
);
4753
}
4854
None => {
4955
println!("ema_price ....... unavailable");

pyth-sdk-solana/examples/get_accounts.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,16 @@ fn main() {
8686
}
8787
}
8888

89-
println!(" price_type ... {}", get_price_type(&price_account.ptype));
89+
println!(
90+
" price_type ... {}",
91+
get_price_type(&price_account.ptype)
92+
);
9093
println!(" exponent ..... {}", price.expo);
94+
println!(" status ....... {}", get_status(&price.status));
9195
println!(
92-
" status ....... {}",
93-
get_status(&price.status)
96+
" corp_act ..... {}",
97+
get_corp_act(&price_account.agg.corp_act)
9498
);
95-
println!(" corp_act ..... {}", get_corp_act(&price_account.agg.corp_act));
9699

97100
println!(" num_qt ....... {}", price_account.num_qt);
98101
println!(" valid_slot ... {}", price_account.valid_slot);
@@ -101,8 +104,14 @@ fn main() {
101104
let maybe_ema_price = price.get_ema_price();
102105
match maybe_ema_price {
103106
Some(ema_price) => {
104-
println!(" ema_price .... {} x 10^{}", ema_price.price, ema_price.expo);
105-
println!(" ema_conf ..... {} x 10^{}", ema_price.conf, ema_price.expo);
107+
println!(
108+
" ema_price .... {} x 10^{}",
109+
ema_price.price, ema_price.expo
110+
);
111+
println!(
112+
" ema_conf ..... {} x 10^{}",
113+
ema_price.conf, ema_price.expo
114+
);
106115
}
107116
None => {
108117
println!(" ema_price .... unavailable");

pyth-sdk-solana/src/state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ pub struct PriceAccount {
296296
/// valid slot-time of agg. price
297297
pub valid_slot: u64,
298298
/// exponentially moving average price
299-
pub ema_price: Rational,
299+
pub ema_price: Rational,
300300
/// exponentially moving average confidence interval
301-
pub ema_conf: Rational,
301+
pub ema_conf: Rational,
302302
/// space for future derived values
303303
pub drv1: i64,
304304
/// space for future derived values
@@ -333,14 +333,14 @@ impl PriceAccount {
333333
pub fn to_price(&self) -> Price {
334334
#[allow(unused_mut)]
335335
let mut status = self.agg.status;
336-
336+
337337
#[cfg(target_arch = "bpf")]
338338
if matches!(status, PriceStatus::Trading)
339339
&& Clock::get().unwrap().slot - self.agg.pub_slot > MAX_SLOT_DIFFERENCE
340340
{
341341
status = PriceStatus::Unknown;
342342
}
343-
343+
344344
Price {
345345
price: self.agg.price,
346346
conf: self.agg.conf,

0 commit comments

Comments
 (0)