Skip to content

Commit 1c82321

Browse files
committed
format
1 parent 1aee40c commit 1c82321

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

target_chains/stylus/contracts/pyth-receiver/src/integration_tests.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,17 @@ mod test {
304304

305305
let first_price_result = pyth_contract.sender(alice).get_price_unsafe(first_id);
306306
assert!(first_price_result.is_ok());
307-
assert_eq!(first_price_result.unwrap(), multiple_updates_results_get_price()[0]);
307+
assert_eq!(
308+
first_price_result.unwrap(),
309+
multiple_updates_results_get_price()[0]
310+
);
308311

309312
let second_price_result = pyth_contract.sender(alice).get_price_unsafe(second_id);
310313
assert!(second_price_result.is_ok());
311-
assert_eq!(second_price_result.unwrap(), multiple_updates_results_get_price()[1]);
314+
assert_eq!(
315+
second_price_result.unwrap(),
316+
multiple_updates_results_get_price()[1]
317+
);
312318
}
313319

314320
#[motsu::test]

target_chains/stylus/contracts/pyth-receiver/src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ impl PythReceiver {
237237
if recent_price_info.publish_time.get() < price_return.1
238238
|| recent_price_info.price.get() == I64::ZERO
239239
{
240-
recent_price_info.price_id.set(FixedBytes::from(price_return.0));
240+
recent_price_info
241+
.price_id
242+
.set(FixedBytes::from(price_return.0));
241243
recent_price_info.publish_time.set(price_return.1);
242244
recent_price_info.expo.set(price_return.2);
243245
recent_price_info.price.set(price_return.3);
@@ -332,7 +334,10 @@ impl PythReceiver {
332334
let mut result: Vec<PriceFeedReturn> = Vec::with_capacity(price_ids.len());
333335

334336
for price_id in price_ids {
335-
if let Some(price_info) = all_parsed_price_feeds.iter().find(|feed| feed.0 == price_id) {
337+
if let Some(price_info) = all_parsed_price_feeds
338+
.iter()
339+
.find(|feed| feed.0 == price_id)
340+
{
336341
result.push(price_info.clone());
337342
} else {
338343
return Err(PythReceiverError::PriceFeedNotFoundWithinRange);
@@ -453,7 +458,10 @@ impl PythReceiver {
453458
}
454459
};
455460

456-
Ok(price_feeds.into_iter().map(|(_, price_info)| price_info).collect())
461+
Ok(price_feeds
462+
.into_iter()
463+
.map(|(_, price_info)| price_info)
464+
.collect())
457465
}
458466

459467
pub fn parse_twap_price_feed_updates(

target_chains/stylus/contracts/pyth-receiver/src/test_data.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ pub fn multiple_updates_first_feed_id() -> [u8; 32] {
4141
#[cfg(test)]
4242
pub fn multiple_updates_second_feed_id() -> [u8; 32] {
4343
[
44-
0xff, 0x61, 0x49, 0x1a, 0x93, 0x11, 0x12, 0xdd, 0xf1, 0xbd, 0x81, 0x47, 0xcd, 0x1b,
45-
0x64, 0x13, 0x75, 0xf7, 0x9f, 0x58, 0x25, 0x12, 0x6d, 0x66, 0x54, 0x80, 0x87, 0x46,
46-
0x34, 0xfd, 0x0a, 0xce,
44+
0xff, 0x61, 0x49, 0x1a, 0x93, 0x11, 0x12, 0xdd, 0xf1, 0xbd, 0x81, 0x47, 0xcd, 0x1b, 0x64,
45+
0x13, 0x75, 0xf7, 0x9f, 0x58, 0x25, 0x12, 0x6d, 0x66, 0x54, 0x80, 0x87, 0x46, 0x34, 0xfd,
46+
0x0a, 0xce,
4747
]
4848
}
4949

5050
#[cfg(test)]
5151
pub fn multiple_updates_diff_first_feed_id() -> [u8; 32] {
5252
[
53-
0x3f, 0xa4, 0x25, 0x28, 0x48, 0xf9, 0xf0, 0xa1, 0x48, 0x0b, 0xe6, 0x27, 0x45, 0xa4,
54-
0x62, 0x9d, 0x9e, 0xb1, 0x32, 0x2a, 0xeb, 0xab, 0x8a, 0x79, 0x1e, 0x34, 0x4b, 0x3b,
55-
0x9c, 0x1a, 0xdc, 0xf5,
53+
0x3f, 0xa4, 0x25, 0x28, 0x48, 0xf9, 0xf0, 0xa1, 0x48, 0x0b, 0xe6, 0x27, 0x45, 0xa4, 0x62,
54+
0x9d, 0x9e, 0xb1, 0x32, 0x2a, 0xeb, 0xab, 0x8a, 0x79, 0x1e, 0x34, 0x4b, 0x3b, 0x9c, 0x1a,
55+
0xdc, 0xf5,
5656
]
5757
}
5858

0 commit comments

Comments
 (0)