@@ -18,7 +18,7 @@ use borsh::{
1818 BorshDeserialize ,
1919 BorshSerialize ,
2020} ;
21- use pyth_sdk_solana:: load_price_feed_from_account_info ;
21+ use pyth_sdk_solana:: state :: SolanaPriceAccount ;
2222
2323use crate :: instruction:: ExampleInstructions ;
2424use crate :: state:: AdminConfig ;
@@ -53,8 +53,8 @@ pub fn process_instruction(
5353 config. collateral_price_feed_id = * pyth_collateral_account. key ;
5454
5555 // Make sure these Pyth price accounts can be loaded
56- load_price_feed_from_account_info ( pyth_loan_account) ?;
57- load_price_feed_from_account_info ( pyth_collateral_account) ?;
56+ SolanaPriceAccount :: account_info_to_feed ( pyth_loan_account) ?;
57+ SolanaPriceAccount :: account_info_to_feed ( pyth_collateral_account) ?;
5858
5959 let config_data = config. try_to_vec ( ) ?;
6060 let config_dst = & mut admin_config_account. try_borrow_mut_data ( ) ?;
@@ -85,7 +85,7 @@ pub fn process_instruction(
8585 // (price + conf) * loan_qty * 10 ^ (expo).
8686 // Here is more explanation on confidence interval in Pyth:
8787 // https://docs.pyth.network/consume-data/best-practices
88- let feed1 = load_price_feed_from_account_info ( pyth_loan_account) ?;
88+ let feed1 = SolanaPriceAccount :: account_info_to_feed ( pyth_loan_account) ?;
8989 let current_timestamp1 = Clock :: get ( ) ?. unix_timestamp ;
9090 let result1 = feed1
9191 . get_price_no_older_than ( current_timestamp1, 60 )
@@ -107,7 +107,7 @@ pub fn process_instruction(
107107 // (price - conf) * collateral_qty * 10 ^ (expo).
108108 // Here is more explanation on confidence interval in Pyth:
109109 // https://docs.pyth.network/consume-data/best-practices
110- let feed2 = load_price_feed_from_account_info ( pyth_collateral_account) ?;
110+ let feed2 = SolanaPriceAccount :: account_info_to_feed ( pyth_collateral_account) ?;
111111 let current_timestamp2 = Clock :: get ( ) ?. unix_timestamp ;
112112 let result2 = feed2
113113 . get_price_no_older_than ( current_timestamp2, 60 )
0 commit comments