Open
Description
when i build this project
msg!("Starting Pyth price check program");
let account_info_iter = &mut accounts.iter();
let pyth_account = next_account_info(account_info_iter)?;
// Get the current time from the Clock sysvar
let clock = Clock::get()?;
let current_time = clock.unix_timestamp;
const STALENESS_THRESHOLD: u64 = 60; // staleness threshold in seconds
// Load the price feed from the account info
// let price_feed = load_price_feed_from_account_info(pyth_account)?;
let price_feed: PriceFeed = SolanaPriceAccount::account_info_to_feed(pyth_account)?;
let current_price: Price = price_feed
.get_price_no_older_than(current_time, STALENESS_THRESHOLD)
.ok_or(ProgramError::InvalidArgument)?;
Metadata
Metadata
Assignees
Labels
No labels