@@ -90,11 +90,12 @@ pub fn resize_price_account(
9090 accounts : & [ AccountInfo ] ,
9191 instruction_data : & [ u8 ] ,
9292) -> ProgramResult {
93- let ( funding_account, price_account, system_program, permissions_account_option) = match accounts {
94- [ x, y, z] => Ok ( ( x, y, z, None ) ) ,
95- [ x, y, z, p] => Ok ( ( x, y, z, Some ( p) ) ) ,
96- _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
97- } ?;
93+ let ( funding_account, price_account, system_program, permissions_account_option) =
94+ match accounts {
95+ [ x, y, z] => Ok ( ( x, y, z, None ) ) ,
96+ [ x, y, z, p] => Ok ( ( x, y, z, Some ( p) ) ) ,
97+ _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
98+ } ?;
9899
99100 let hdr = load :: < CommandHeader > ( instruction_data) ?;
100101
@@ -136,8 +137,7 @@ pub fn resize_price_account(
136137
137138 // Check that everything is ok
138139 check_valid_signable_account ( program_id, price_account) ?;
139- let mut price_account =
140- load_checked :: < PriceAccountWrapper > ( price_account, PC_VERSION ) ?;
140+ let mut price_account = load_checked :: < PriceAccountWrapper > ( price_account, PC_VERSION ) ?;
141141 // Initialize Time Machine
142142 price_account. initialize_time_machine ( ) ?;
143143 Ok ( ( ) )
@@ -207,7 +207,7 @@ pub fn add_mapping(
207207 permissions_account_option,
208208 hdr,
209209 ) ?;
210-
210+
211211 let mut cur_mapping = load_checked :: < MappingAccount > ( cur_mapping, hdr. version ) ?;
212212 pyth_assert (
213213 cur_mapping. number_of_products == PC_MAP_TABLE_SIZE
@@ -349,11 +349,12 @@ pub fn add_price(
349349 ) ?;
350350
351351
352- let ( funding_account, product_account, price_account, permissions_account_option) = match accounts {
353- [ x, y, z] => Ok ( ( x, y, z, None ) ) ,
354- [ x, y, z, p] => Ok ( ( x, y, z, Some ( p) ) ) ,
355- _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
356- } ?;
352+ let ( funding_account, product_account, price_account, permissions_account_option) =
353+ match accounts {
354+ [ x, y, z] => Ok ( ( x, y, z, None ) ) ,
355+ [ x, y, z, p] => Ok ( ( x, y, z, Some ( p) ) ) ,
356+ _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
357+ } ?;
357358
358359 check_valid_funding_account ( funding_account) ?;
359360 check_valid_signable_account_or_permissioned_funding_account (
@@ -397,11 +398,12 @@ pub fn del_price(
397398 accounts : & [ AccountInfo ] ,
398399 instruction_data : & [ u8 ] ,
399400) -> ProgramResult {
400- let ( funding_account, product_account, price_account, permissions_account_option) = match accounts {
401- [ w, x, y] => Ok ( ( w, x, y, None ) ) ,
402- [ w, x, y, p] => Ok ( ( w, x, y, Some ( p) ) ) ,
403- _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
404- } ?;
401+ let ( funding_account, product_account, price_account, permissions_account_option) =
402+ match accounts {
403+ [ w, x, y] => Ok ( ( w, x, y, None ) ) ,
404+ [ w, x, y, p] => Ok ( ( w, x, y, Some ( p) ) ) ,
405+ _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
406+ } ?;
405407
406408 let cmd_args = load :: < CommandHeader > ( instruction_data) ?;
407409
@@ -411,18 +413,17 @@ pub fn del_price(
411413 product_account,
412414 funding_account,
413415 permissions_account_option,
414- & cmd_args,
416+ cmd_args,
415417 ) ?;
416418 check_valid_signable_account_or_permissioned_funding_account (
417419 program_id,
418420 price_account,
419421 funding_account,
420422 permissions_account_option,
421- & cmd_args,
423+ cmd_args,
422424 ) ?;
423425
424426 {
425-
426427 let mut product_data = load_checked :: < ProductAccount > ( product_account, cmd_args. version ) ?;
427428 let price_data = load_checked :: < PriceAccount > ( price_account, cmd_args. version ) ?;
428429 pyth_assert (
@@ -636,11 +637,12 @@ pub fn add_product(
636637 accounts : & [ AccountInfo ] ,
637638 instruction_data : & [ u8 ] ,
638639) -> ProgramResult {
639- let ( funding_account, tail_mapping_account, new_product_account, permissions_account_option) = match accounts {
640- [ x, y, z] => Ok ( ( x, y, z, None ) ) ,
641- [ x, y, z, p] => Ok ( ( x, y, z, Some ( p) ) ) ,
642- _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
643- } ?;
640+ let ( funding_account, tail_mapping_account, new_product_account, permissions_account_option) =
641+ match accounts {
642+ [ x, y, z] => Ok ( ( x, y, z, None ) ) ,
643+ [ x, y, z, p] => Ok ( ( x, y, z, Some ( p) ) ) ,
644+ _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
645+ } ?;
644646
645647 let hdr = load :: < CommandHeader > ( instruction_data) ?;
646648
@@ -650,17 +652,17 @@ pub fn add_product(
650652 tail_mapping_account,
651653 funding_account,
652654 permissions_account_option,
653- & hdr,
655+ hdr,
654656 ) ?;
655657 check_valid_signable_account_or_permissioned_funding_account (
656658 program_id,
657659 new_product_account,
658660 funding_account,
659661 permissions_account_option,
660- & hdr,
662+ hdr,
661663 ) ?;
662664
663-
665+
664666 let mut mapping_data = load_checked :: < MappingAccount > ( tail_mapping_account, hdr. version ) ?;
665667 // The mapping account must have free space to add the product account
666668 pyth_assert (
@@ -702,10 +704,10 @@ pub fn upd_product(
702704 product_account,
703705 funding_account,
704706 permissions_account_option,
705- & hdr,
707+ hdr,
706708 ) ?;
707709
708-
710+
709711 {
710712 // Validate that product_account contains the appropriate account header
711713 let mut _product_data = load_checked :: < ProductAccount > ( product_account, hdr. version ) ?;
@@ -796,11 +798,12 @@ pub fn del_product(
796798 accounts : & [ AccountInfo ] ,
797799 instruction_data : & [ u8 ] ,
798800) -> ProgramResult {
799- let ( funding_account, mapping_account, product_account, permissions_account_option) = match accounts {
800- [ w, x, y] => Ok ( ( w, x, y, None ) ) ,
801- [ w, x, y, p] => Ok ( ( w, x, y, Some ( p) ) ) ,
802- _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
803- } ?;
801+ let ( funding_account, mapping_account, product_account, permissions_account_option) =
802+ match accounts {
803+ [ w, x, y] => Ok ( ( w, x, y, None ) ) ,
804+ [ w, x, y, p] => Ok ( ( w, x, y, Some ( p) ) ) ,
805+ _ => Err ( OracleError :: InvalidNumberOfAccounts ) ,
806+ } ?;
804807
805808 let cmd_args = load :: < CommandHeader > ( instruction_data) ?;
806809
@@ -810,20 +813,19 @@ pub fn del_product(
810813 mapping_account,
811814 funding_account,
812815 permissions_account_option,
813- & cmd_args,
816+ cmd_args,
814817 ) ?;
815818
816819 check_valid_signable_account_or_permissioned_funding_account (
817820 program_id,
818821 product_account,
819822 funding_account,
820823 permissions_account_option,
821- & cmd_args,
824+ cmd_args,
822825 ) ?;
823826
824827
825828 {
826-
827829 let mut mapping_data = load_checked :: < MappingAccount > ( mapping_account, cmd_args. version ) ?;
828830 let product_data = load_checked :: < ProductAccount > ( product_account, cmd_args. version ) ?;
829831
0 commit comments