55 load_command_header_checked,
66 OracleCommand ,
77 } ,
8- rust_oracle:: {
9- add_mapping,
10- add_price,
11- add_product,
12- add_publisher,
13- del_price,
14- del_product,
15- del_publisher,
16- init_mapping,
17- init_price,
18- resize_price_account,
19- set_min_pub,
20- upd_permissions,
21- upd_price,
22- upd_price_no_fail_on_error,
23- upd_product,
24- } ,
258 } ,
269 solana_program:: {
2710 entrypoint:: ProgramResult ,
@@ -30,34 +13,67 @@ use {
3013 } ,
3114} ;
3215
16+ mod add_mapping;
17+ mod add_price;
18+ mod add_product;
19+ mod add_publisher;
20+ mod del_price;
21+ mod del_product;
22+ mod del_publisher;
23+ mod init_mapping;
24+ mod init_price;
25+ mod resize_price_account;
26+ mod set_min_pub;
27+ mod upd_permissions;
28+ mod upd_price;
29+ mod upd_product;
30+
31+ pub use {
32+ add_mapping:: add_mapping,
33+ add_price:: add_price,
34+ add_product:: add_product,
35+ add_publisher:: add_publisher,
36+ del_price:: del_price,
37+ del_product:: del_product,
38+ del_publisher:: del_publisher,
39+ init_mapping:: init_mapping,
40+ init_price:: init_price,
41+ resize_price_account:: resize_price_account,
42+ set_min_pub:: set_min_pub,
43+ upd_permissions:: upd_permissions,
44+ upd_price:: {
45+ upd_price,
46+ upd_price_no_fail_on_error,
47+ } ,
48+ upd_product:: upd_product,
49+ } ;
50+
3351/// Dispatch to the right instruction in the oracle.
3452pub fn process_instruction (
3553 program_id : & Pubkey ,
3654 accounts : & [ AccountInfo ] ,
3755 instruction_data : & [ u8 ] ,
3856) -> ProgramResult {
57+ use OracleCommand :: * ;
58+
3959 match load_command_header_checked ( instruction_data) ? {
40- OracleCommand :: InitMapping => init_mapping ( program_id, accounts, instruction_data) ,
41- OracleCommand :: AddMapping => add_mapping ( program_id, accounts, instruction_data) ,
42- OracleCommand :: AddProduct => add_product ( program_id, accounts, instruction_data) ,
43- OracleCommand :: UpdProduct => upd_product ( program_id, accounts, instruction_data) ,
44- OracleCommand :: AddPrice => add_price ( program_id, accounts, instruction_data) ,
45- OracleCommand :: AddPublisher => add_publisher ( program_id, accounts, instruction_data) ,
46- OracleCommand :: DelPublisher => del_publisher ( program_id, accounts, instruction_data) ,
47- OracleCommand :: UpdPrice => upd_price ( program_id, accounts, instruction_data) ,
48- OracleCommand :: AggPrice => upd_price ( program_id, accounts, instruction_data) ,
49- OracleCommand :: InitPrice => init_price ( program_id, accounts, instruction_data) ,
50- OracleCommand :: InitTest => Err ( OracleError :: UnrecognizedInstruction . into ( ) ) ,
51- OracleCommand :: UpdTest => Err ( OracleError :: UnrecognizedInstruction . into ( ) ) ,
52- OracleCommand :: SetMinPub => set_min_pub ( program_id, accounts, instruction_data) ,
53- OracleCommand :: UpdPriceNoFailOnError => {
54- upd_price_no_fail_on_error ( program_id, accounts, instruction_data)
55- }
56- OracleCommand :: ResizePriceAccount => {
57- resize_price_account ( program_id, accounts, instruction_data)
58- }
59- OracleCommand :: DelPrice => del_price ( program_id, accounts, instruction_data) ,
60- OracleCommand :: DelProduct => del_product ( program_id, accounts, instruction_data) ,
61- OracleCommand :: UpdPermissions => upd_permissions ( program_id, accounts, instruction_data) ,
60+ InitMapping => init_mapping ( program_id, accounts, instruction_data) ,
61+ AddMapping => add_mapping ( program_id, accounts, instruction_data) ,
62+ AddProduct => add_product ( program_id, accounts, instruction_data) ,
63+ UpdProduct => upd_product ( program_id, accounts, instruction_data) ,
64+ AddPrice => add_price ( program_id, accounts, instruction_data) ,
65+ AddPublisher => add_publisher ( program_id, accounts, instruction_data) ,
66+ DelPublisher => del_publisher ( program_id, accounts, instruction_data) ,
67+ UpdPrice => upd_price ( program_id, accounts, instruction_data) ,
68+ AggPrice => upd_price ( program_id, accounts, instruction_data) ,
69+ InitPrice => init_price ( program_id, accounts, instruction_data) ,
70+ InitTest => Err ( OracleError :: UnrecognizedInstruction . into ( ) ) ,
71+ UpdTest => Err ( OracleError :: UnrecognizedInstruction . into ( ) ) ,
72+ SetMinPub => set_min_pub ( program_id, accounts, instruction_data) ,
73+ UpdPriceNoFailOnError => upd_price_no_fail_on_error ( program_id, accounts, instruction_data) ,
74+ ResizePriceAccount => resize_price_account ( program_id, accounts, instruction_data) ,
75+ DelPrice => del_price ( program_id, accounts, instruction_data) ,
76+ DelProduct => del_product ( program_id, accounts, instruction_data) ,
77+ UpdPermissions => upd_permissions ( program_id, accounts, instruction_data) ,
6278 }
6379}
0 commit comments