Skip to content

Commit fcd55c4

Browse files
committed
finished price_feed_exists method
1 parent d6b04e0 commit fcd55c4

File tree

1 file changed

+6
-0
lines changed
  • target_chains/stylus/contracts/pyth-receiver/src

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ impl PythReceiver {
111111
}
112112
}
113113

114+
pub fn price_feed_exists(&self, id: [u8; 32]) -> bool {
115+
let id_fb = FixedBytes::<32>::from(id);
116+
let price_info = self.latest_price_info.get(id_fb);
117+
return price_info.publish_time.get() != U64::ZERO;
118+
}
119+
114120
pub fn query_price_feed(&self, id: [u8; 32]) -> Result<PriceFeedReturn, PythReceiverError> {
115121
let id_fb = FixedBytes::<32>::from(id);
116122

0 commit comments

Comments
 (0)