@@ -9,7 +9,7 @@ use bytemuck::{
99} ;
1010use solana_program:: account_info:: AccountInfo ;
1111use solana_program:: clock:: Clock ;
12- use solana_program:: entrypoint:: SUCCESS ;
12+ use solana_program:: entrypoint:: ProgramResult ;
1313use solana_program:: program_error:: ProgramError ;
1414use solana_program:: program_memory:: {
1515 sol_memcpy,
@@ -57,7 +57,6 @@ use crate::deserialize::{
5757 load_account_as_mut,
5858 load_checked,
5959} ;
60- use crate :: error:: OracleResult ;
6160use crate :: OracleError ;
6261
6362use crate :: utils:: {
@@ -113,7 +112,7 @@ pub fn resize_price_account(
113112 program_id : & Pubkey ,
114113 accounts : & [ AccountInfo ] ,
115114 _instruction_data : & [ u8 ] ,
116- ) -> OracleResult {
115+ ) -> ProgramResult {
117116 let [ funding_account_info, price_account_info, system_program] = match accounts {
118117 [ x, y, z] => Ok ( [ x, y, z] ) ,
119118 _ => Err ( ProgramError :: InvalidArgument ) ,
@@ -156,9 +155,9 @@ pub fn resize_price_account(
156155 load_checked :: < PriceAccountWrapper > ( price_account_info, PC_VERSION ) ?;
157156 //Initialize Time Machine
158157 price_account. initialize_time_machine ( ) ?;
159- Ok ( SUCCESS )
158+ Ok ( ( ) )
160159 }
161- PRICE_ACCOUNT_SIZE => Ok ( SUCCESS ) ,
160+ PRICE_ACCOUNT_SIZE => Ok ( ( ) ) ,
162161 _ => Err ( ProgramError :: InvalidArgument ) ,
163162 }
164163}
@@ -171,7 +170,7 @@ pub fn init_mapping(
171170 program_id : & Pubkey ,
172171 accounts : & [ AccountInfo ] ,
173172 instruction_data : & [ u8 ] ,
174- ) -> OracleResult {
173+ ) -> ProgramResult {
175174 let [ funding_account, fresh_mapping_account] = match accounts {
176175 [ x, y] => Ok ( [ x, y] ) ,
177176 _ => Err ( ProgramError :: InvalidArgument ) ,
@@ -189,14 +188,14 @@ pub fn init_mapping(
189188 let hdr = load :: < cmd_hdr_t > ( instruction_data) ?;
190189 initialize_pyth_account_checked :: < pc_map_table_t > ( fresh_mapping_account, hdr. ver_ ) ?;
191190
192- Ok ( SUCCESS )
191+ Ok ( ( ) )
193192}
194193
195194pub fn add_mapping (
196195 program_id : & Pubkey ,
197196 accounts : & [ AccountInfo ] ,
198197 instruction_data : & [ u8 ] ,
199- ) -> OracleResult {
198+ ) -> ProgramResult {
200199 let [ funding_account, cur_mapping, next_mapping] = match accounts {
201200 [ x, y, z] => Ok ( [ x, y, z] ) ,
202201 _ => Err ( ProgramError :: InvalidArgument ) ,
@@ -217,7 +216,7 @@ pub fn add_mapping(
217216 initialize_pyth_account_checked :: < pc_map_table_t > ( next_mapping, hdr. ver_ ) ?;
218217 pubkey_assign ( & mut cur_mapping. next_ , & next_mapping. key . to_bytes ( ) ) ;
219218
220- Ok ( SUCCESS )
219+ Ok ( ( ) )
221220}
222221
223222/// a publisher updates a price
@@ -228,7 +227,7 @@ pub fn upd_price(
228227 program_id : & Pubkey ,
229228 accounts : & [ AccountInfo ] ,
230229 instruction_data : & [ u8 ] ,
231- ) -> OracleResult {
230+ ) -> ProgramResult {
232231 let cmd_args = load :: < cmd_upd_price_t > ( instruction_data) ?;
233232
234233 let [ funding_account, price_account, clock_account] = match accounts {
@@ -316,16 +315,16 @@ pub fn upd_price(
316315 }
317316 }
318317
319- Ok ( SUCCESS )
318+ Ok ( ( ) )
320319}
321320
322321pub fn upd_price_no_fail_on_error (
323322 program_id : & Pubkey ,
324323 accounts : & [ AccountInfo ] ,
325324 instruction_data : & [ u8 ] ,
326- ) -> OracleResult {
325+ ) -> ProgramResult {
327326 match upd_price ( program_id, accounts, instruction_data) {
328- Err ( _) => Ok ( SUCCESS ) ,
327+ Err ( _) => Ok ( ( ) ) ,
329328 Ok ( value) => Ok ( value) ,
330329 }
331330}
@@ -339,7 +338,7 @@ pub fn add_price(
339338 program_id : & Pubkey ,
340339 accounts : & [ AccountInfo ] ,
341340 instruction_data : & [ u8 ] ,
342- ) -> OracleResult {
341+ ) -> ProgramResult {
343342 let cmd_args = load :: < cmd_add_price_t > ( instruction_data) ?;
344343
345344 check_exponent_range ( cmd_args. expo_ ) ?;
@@ -369,14 +368,14 @@ pub fn add_price(
369368 pubkey_assign ( & mut price_data. next_ , bytes_of ( & product_data. px_acc_ ) ) ;
370369 pubkey_assign ( & mut product_data. px_acc_ , & price_account. key . to_bytes ( ) ) ;
371370
372- Ok ( SUCCESS )
371+ Ok ( ( ) )
373372}
374373
375374pub fn init_price (
376375 program_id : & Pubkey ,
377376 accounts : & [ AccountInfo ] ,
378377 instruction_data : & [ u8 ] ,
379- ) -> OracleResult {
378+ ) -> ProgramResult {
380379 let cmd_args = load :: < cmd_init_price_t > ( instruction_data) ?;
381380
382381 check_exponent_range ( cmd_args. expo_ ) ?;
@@ -432,7 +431,7 @@ pub fn init_price(
432431 ) ;
433432 }
434433
435- Ok ( SUCCESS )
434+ Ok ( ( ) )
436435}
437436
438437/// add a publisher to a price account
@@ -442,7 +441,7 @@ pub fn add_publisher(
442441 program_id : & Pubkey ,
443442 accounts : & [ AccountInfo ] ,
444443 instruction_data : & [ u8 ] ,
445- ) -> OracleResult {
444+ ) -> ProgramResult {
446445 let cmd_args = load :: < cmd_add_publisher_t > ( instruction_data) ?;
447446
448447 pyth_assert (
@@ -485,7 +484,7 @@ pub fn add_publisher(
485484 price_data. size_ =
486485 try_convert :: < _ , u32 > ( size_of :: < pc_price_t > ( ) - size_of_val ( & price_data. comp_ ) ) ?
487486 + price_data. num_ * try_convert :: < _ , u32 > ( size_of :: < pc_price_comp > ( ) ) ?;
488- Ok ( SUCCESS )
487+ Ok ( ( ) )
489488}
490489
491490/// add a publisher to a price account
@@ -495,7 +494,7 @@ pub fn del_publisher(
495494 program_id : & Pubkey ,
496495 accounts : & [ AccountInfo ] ,
497496 instruction_data : & [ u8 ] ,
498- ) -> OracleResult {
497+ ) -> ProgramResult {
499498 let cmd_args = load :: < cmd_del_publisher_t > ( instruction_data) ?;
500499
501500 pyth_assert (
@@ -529,7 +528,7 @@ pub fn del_publisher(
529528 price_data. size_ =
530529 try_convert :: < _ , u32 > ( size_of :: < pc_price_t > ( ) - size_of_val ( & price_data. comp_ ) ) ?
531530 + price_data. num_ * try_convert :: < _ , u32 > ( size_of :: < pc_price_comp > ( ) ) ?;
532- return Ok ( SUCCESS ) ;
531+ return Ok ( ( ) ) ;
533532 }
534533 }
535534 Err ( ProgramError :: InvalidArgument )
@@ -539,7 +538,7 @@ pub fn add_product(
539538 program_id : & Pubkey ,
540539 accounts : & [ AccountInfo ] ,
541540 instruction_data : & [ u8 ] ,
542- ) -> OracleResult {
541+ ) -> ProgramResult {
543542 let [ funding_account, tail_mapping_account, new_product_account] = match accounts {
544543 [ x, y, z] => Ok ( [ x, y, z] ) ,
545544 _ => Err ( ProgramError :: InvalidArgument ) ,
@@ -574,7 +573,7 @@ pub fn add_product(
574573 try_convert :: < _ , u32 > ( size_of :: < pc_map_table_t > ( ) - size_of_val ( & mapping_data. prod_ ) ) ?
575574 + mapping_data. num_ * try_convert :: < _ , u32 > ( size_of :: < pc_pub_key_t > ( ) ) ?;
576575
577- Ok ( SUCCESS )
576+ Ok ( ( ) )
578577}
579578
580579/// Update the metadata associated with a product, overwriting any existing metadata.
@@ -583,7 +582,7 @@ pub fn upd_product(
583582 program_id : & Pubkey ,
584583 accounts : & [ AccountInfo ] ,
585584 instruction_data : & [ u8 ] ,
586- ) -> OracleResult {
585+ ) -> ProgramResult {
587586 let [ funding_account, product_account] = match accounts {
588587 [ x, y] => Ok ( [ x, y] ) ,
589588 _ => Err ( ProgramError :: InvalidArgument ) ,
@@ -634,14 +633,14 @@ pub fn upd_product(
634633 let mut product_data = load_checked :: < pc_prod_t > ( product_account, hdr. ver_ ) ?;
635634 product_data. size_ = try_convert ( size_of :: < pc_prod_t > ( ) + new_data. len ( ) ) ?;
636635
637- Ok ( SUCCESS )
636+ Ok ( ( ) )
638637}
639638
640639pub fn set_min_pub (
641640 program_id : & Pubkey ,
642641 accounts : & [ AccountInfo ] ,
643642 instruction_data : & [ u8 ] ,
644- ) -> OracleResult {
643+ ) -> ProgramResult {
645644 let cmd = load :: < cmd_set_min_pub_t > ( instruction_data) ?;
646645
647646 pyth_assert (
@@ -660,5 +659,5 @@ pub fn set_min_pub(
660659 let mut price_account_data = load_checked :: < pc_price_t > ( price_account, cmd. ver_ ) ?;
661660 price_account_data. min_pub_ = cmd. min_pub_ ;
662661
663- Ok ( SUCCESS )
662+ Ok ( ( ) )
664663}
0 commit comments