@@ -18,7 +18,7 @@ use borsh::{
18
18
BorshDeserialize ,
19
19
BorshSerialize ,
20
20
} ;
21
- use pyth_sdk_solana:: load_price_feed_from_account_info ;
21
+ use pyth_sdk_solana:: state :: SolanaPriceAccount ;
22
22
23
23
use crate :: instruction:: ExampleInstructions ;
24
24
use crate :: state:: AdminConfig ;
@@ -53,8 +53,8 @@ pub fn process_instruction(
53
53
config. collateral_price_feed_id = * pyth_collateral_account. key ;
54
54
55
55
// 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) ?;
58
58
59
59
let config_data = config. try_to_vec ( ) ?;
60
60
let config_dst = & mut admin_config_account. try_borrow_mut_data ( ) ?;
@@ -85,7 +85,7 @@ pub fn process_instruction(
85
85
// (price + conf) * loan_qty * 10 ^ (expo).
86
86
// Here is more explanation on confidence interval in Pyth:
87
87
// 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) ?;
89
89
let current_timestamp1 = Clock :: get ( ) ?. unix_timestamp ;
90
90
let result1 = feed1
91
91
. get_price_no_older_than ( current_timestamp1, 60 )
@@ -107,7 +107,7 @@ pub fn process_instruction(
107
107
// (price - conf) * collateral_qty * 10 ^ (expo).
108
108
// Here is more explanation on confidence interval in Pyth:
109
109
// 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) ?;
111
111
let current_timestamp2 = Clock :: get ( ) ?. unix_timestamp ;
112
112
let result2 = feed2
113
113
. get_price_no_older_than ( current_timestamp2, 60 )
0 commit comments