File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
contracts/oracle/osmosis/src Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -707,18 +707,17 @@ impl OsmosisPriceSourceChecked {
707
707
let price_feed_response = query_price_feed ( & deps. querier , contract_addr, price_feed_id) ?;
708
708
let price_feed = price_feed_response. price_feed ;
709
709
710
- // Get the current price and confidence interval from the price feed
711
- let current_price = price_feed. get_price_unchecked ( ) ;
712
-
713
710
// Check if the current price is not too old
714
- if ( current_time - current_price. publish_time as u64 ) > max_staleness {
711
+ let current_price_opt =
712
+ price_feed. get_price_no_older_than ( current_time as i64 , max_staleness) ;
713
+ let Some ( current_price) = current_price_opt else {
715
714
return Err ( InvalidPrice {
716
715
reason : format ! (
717
716
"current price publish time is too old/stale. published: {}, now: {}" ,
718
- current_price . publish_time, current_time
717
+ price_feed . get_price_unchecked ( ) . publish_time, current_time
719
718
) ,
720
719
} ) ;
721
- }
720
+ } ;
722
721
723
722
// Check if the current price is > 0
724
723
if current_price. price <= 0 {
You can’t perform that action at this time.
0 commit comments