@@ -13,7 +13,7 @@ const ORACLE_MAX_PRICE: u64 = (1 << 28) - 1;
1313#[ derive( Copy , Clone , PartialEq , AnchorSerialize , AnchorDeserialize , Debug ) ]
1414pub enum OracleType {
1515 None ,
16- Test ,
16+ Custom ,
1717 Pyth ,
1818}
1919
@@ -39,15 +39,15 @@ pub struct OracleParams {
3939
4040#[ account]
4141#[ derive( Default , Debug ) ]
42- pub struct TestOracle {
42+ pub struct CustomOracle {
4343 pub price : u64 ,
4444 pub expo : i32 ,
4545 pub conf : u64 ,
4646 pub publish_time : i64 ,
4747}
4848
49- impl TestOracle {
50- pub const LEN : usize = 8 + std:: mem:: size_of :: < TestOracle > ( ) ;
49+ impl CustomOracle {
50+ pub const LEN : usize = 8 + std:: mem:: size_of :: < CustomOracle > ( ) ;
5151}
5252
5353impl PartialOrd for OraclePrice {
@@ -89,7 +89,7 @@ impl OraclePrice {
8989 use_ema : bool ,
9090 ) -> Result < Self > {
9191 match oracle_params. oracle_type {
92- OracleType :: Test => Self :: get_test_price (
92+ OracleType :: Custom => Self :: get_custom_price (
9393 oracle_account,
9494 oracle_params. max_price_error ,
9595 oracle_params. max_price_age_sec ,
@@ -226,22 +226,22 @@ impl OraclePrice {
226226 }
227227
228228 // private helpers
229- fn get_test_price (
230- test_price_info : & AccountInfo ,
229+ fn get_custom_price (
230+ custom_price_info : & AccountInfo ,
231231 max_price_error : u64 ,
232232 max_price_age_sec : u32 ,
233233 current_time : i64 ,
234234 ) -> Result < OraclePrice > {
235235 require ! (
236- !Perpetuals :: is_empty_account( test_price_info ) ?,
236+ !Perpetuals :: is_empty_account( custom_price_info ) ?,
237237 PerpetualsError :: InvalidOracleAccount
238238 ) ;
239239
240- let oracle_acc = Account :: < TestOracle > :: try_from ( test_price_info ) ?;
240+ let oracle_acc = Account :: < CustomOracle > :: try_from ( custom_price_info ) ?;
241241
242242 let last_update_age_sec = math:: checked_sub ( current_time, oracle_acc. publish_time ) ?;
243243 if last_update_age_sec > max_price_age_sec as i64 {
244- msg ! ( "Error: Test oracle price is stale" ) ;
244+ msg ! ( "Error: Custom oracle price is stale" ) ;
245245 return err ! ( PerpetualsError :: StaleOraclePrice ) ;
246246 }
247247
@@ -251,7 +251,7 @@ impl OraclePrice {
251251 oracle_acc. price as u128 ,
252252 ) ? > max_price_error as u128
253253 {
254- msg ! ( "Error: Test oracle price is out of bounds" ) ;
254+ msg ! ( "Error: Custom oracle price is out of bounds" ) ;
255255 return err ! ( PerpetualsError :: InvalidOraclePrice ) ;
256256 }
257257
0 commit comments