@@ -39,7 +39,7 @@ use pythnet_sdk::{
39
39
} ,
40
40
} ,
41
41
} ;
42
- use structs:: { DataSource , DataSourceStorage , PriceInfoReturn , PriceInfoStorage } ;
42
+ use structs:: { DataSource , DataSourceStorage , PriceFeedReturn , PriceInfoStorage } ;
43
43
use wormhole_vaas:: { Readable , Vaa , Writeable } ;
44
44
45
45
sol_interface ! {
@@ -111,7 +111,7 @@ impl PythReceiver {
111
111
}
112
112
}
113
113
114
- pub fn get_price_unsafe ( & self , id : [ u8 ; 32 ] ) -> Result < PriceInfoReturn , PythReceiverError > {
114
+ pub fn get_price_unsafe ( & self , id : [ u8 ; 32 ] ) -> Result < PriceFeedReturn , PythReceiverError > {
115
115
let id_fb = FixedBytes :: < 32 > :: from ( id) ;
116
116
117
117
let price_info = self . latest_price_info . get ( id_fb) ;
@@ -134,15 +134,15 @@ impl PythReceiver {
134
134
& self ,
135
135
id : [ u8 ; 32 ] ,
136
136
age : u64 ,
137
- ) -> Result < PriceInfoReturn , PythReceiverError > {
137
+ ) -> Result < PriceFeedReturn , PythReceiverError > {
138
138
let price_info = self . get_price_unsafe ( id) ?;
139
139
if !self . is_no_older_than ( price_info. 0 , age) {
140
140
return Err ( PythReceiverError :: NewPriceUnavailable ) ;
141
141
}
142
142
Ok ( price_info)
143
143
}
144
144
145
- pub fn get_ema_price_unsafe ( & self , id : [ u8 ; 32 ] ) -> Result < PriceInfoReturn , PythReceiverError > {
145
+ pub fn get_ema_price_unsafe ( & self , id : [ u8 ; 32 ] ) -> Result < PriceFeedReturn , PythReceiverError > {
146
146
let id_fb = FixedBytes :: < 32 > :: from ( id) ;
147
147
let price_info = self . latest_price_info . get ( id_fb) ;
148
148
@@ -164,7 +164,7 @@ impl PythReceiver {
164
164
& self ,
165
165
id : [ u8 ; 32 ] ,
166
166
age : u64 ,
167
- ) -> Result < PriceInfoReturn , PythReceiverError > {
167
+ ) -> Result < PriceFeedReturn , PythReceiverError > {
168
168
let price_info = self . get_ema_price_unsafe ( id) ?;
169
169
if !self . is_no_older_than ( price_info. 0 , age) {
170
170
return Err ( PythReceiverError :: NewPriceUnavailable ) ;
@@ -204,7 +204,7 @@ impl PythReceiver {
204
204
}
205
205
206
206
for i in 0 ..price_ids. len ( ) {
207
- if ( self . latest_price_info_publish_time ( price_ids[ i] ) < publish_times[ i] ) {
207
+ if self . latest_price_info_publish_time ( price_ids[ i] ) < publish_times[ i] {
208
208
self . update_price_feeds ( update_data. clone ( ) ) ?;
209
209
return Ok ( ( ) ) ;
210
210
}
@@ -226,7 +226,7 @@ impl PythReceiver {
226
226
min_publish_time : u64 ,
227
227
max_publish_time : u64 ,
228
228
_unique : bool ,
229
- ) -> Result < Vec < ( [ u8 ; 32 ] , PriceInfoReturn ) > , PythReceiverError > {
229
+ ) -> Result < Vec < ( [ u8 ; 32 ] , PriceFeedReturn ) > , PythReceiverError > {
230
230
let price_pairs = self . parse_price_feed_updates_internal (
231
231
update_data,
232
232
min_publish_time,
@@ -285,7 +285,7 @@ impl PythReceiver {
285
285
price_ids : Vec < [ u8 ; 32 ] > ,
286
286
min_publish_time : u64 ,
287
287
max_publish_time : u64 ,
288
- ) -> Result < Vec < PriceInfoReturn > , PythReceiverError > {
288
+ ) -> Result < Vec < PriceFeedReturn > , PythReceiverError > {
289
289
let price_feeds = self . parse_price_feed_updates_with_config (
290
290
vec ! [ update_data] ,
291
291
price_ids,
@@ -307,7 +307,7 @@ impl PythReceiver {
307
307
check_uniqueness : bool ,
308
308
check_update_data_is_minimal : bool ,
309
309
store_updates_if_fresh : bool ,
310
- ) -> Result < Vec < PriceInfoReturn > , PythReceiverError > {
310
+ ) -> Result < Vec < PriceFeedReturn > , PythReceiverError > {
311
311
let mut all_parsed_price_pairs = Vec :: new ( ) ;
312
312
for data in & update_data {
313
313
if store_updates_if_fresh {
@@ -332,8 +332,8 @@ impl PythReceiver {
332
332
return Err ( PythReceiverError :: InvalidUpdateData ) ;
333
333
}
334
334
335
- let mut result: Vec < PriceInfoReturn > = Vec :: with_capacity ( price_ids. len ( ) ) ;
336
- let mut price_map: BTreeMap < [ u8 ; 32 ] , PriceInfoReturn > = BTreeMap :: new ( ) ;
335
+ let mut result: Vec < PriceFeedReturn > = Vec :: with_capacity ( price_ids. len ( ) ) ;
336
+ let mut price_map: BTreeMap < [ u8 ; 32 ] , PriceFeedReturn > = BTreeMap :: new ( ) ;
337
337
338
338
for ( price_id, price_info) in all_parsed_price_pairs {
339
339
if !price_map. contains_key ( & price_id) {
@@ -358,7 +358,7 @@ impl PythReceiver {
358
358
min_allowed_publish_time : u64 ,
359
359
max_allowed_publish_time : u64 ,
360
360
check_uniqueness : bool ,
361
- ) -> Result < Vec < ( [ u8 ; 32 ] , PriceInfoReturn ) > , PythReceiverError > {
361
+ ) -> Result < Vec < ( [ u8 ; 32 ] , PriceFeedReturn ) > , PythReceiverError > {
362
362
let update_data_array: & [ u8 ] = & update_data;
363
363
// Check the first 4 bytes of the update_data_array for the magic header
364
364
if update_data_array. len ( ) < 4 {
@@ -375,7 +375,7 @@ impl PythReceiver {
375
375
let accumulator_update = AccumulatorUpdateData :: try_from_slice ( & update_data_array)
376
376
. map_err ( |_| PythReceiverError :: InvalidAccumulatorMessage ) ?;
377
377
378
- let mut price_feeds: BTreeMap < [ u8 ; 32 ] , PriceInfoReturn > = BTreeMap :: new ( ) ;
378
+ let mut price_feeds: BTreeMap < [ u8 ; 32 ] , PriceFeedReturn > = BTreeMap :: new ( ) ;
379
379
380
380
match accumulator_update. proof {
381
381
Proof :: WormholeMerkle { vaa, updates } => {
@@ -469,7 +469,7 @@ impl PythReceiver {
469
469
& mut self ,
470
470
_update_data : Vec < Vec < u8 > > ,
471
471
_price_ids : Vec < [ u8 ; 32 ] > ,
472
- ) -> Vec < PriceInfoReturn > {
472
+ ) -> Vec < PriceFeedReturn > {
473
473
Vec :: new ( )
474
474
}
475
475
@@ -479,7 +479,7 @@ impl PythReceiver {
479
479
price_ids : Vec < [ u8 ; 32 ] > ,
480
480
min_publish_time : u64 ,
481
481
max_publish_time : u64 ,
482
- ) -> Result < Vec < PriceInfoReturn > , PythReceiverError > {
482
+ ) -> Result < Vec < PriceFeedReturn > , PythReceiverError > {
483
483
let price_feeds = self . parse_price_feed_updates_with_config (
484
484
update_data,
485
485
price_ids,
0 commit comments