MCPcopy Create free account
hub / github.com/Bonfida/dex-v4 / process_instruction

Method process_instruction

program/src/processor.rs:60–117  ·  view source on GitHub ↗
(
        program_id: &Pubkey,
        accounts: &[AccountInfo],
        instruction_data: &[u8],
    )

Source from the content-addressed store, hash-verified

58
59impl Processor {
60 pub fn process_instruction(
61 program_id: &Pubkey,
62 accounts: &[AccountInfo],
63 instruction_data: &[u8],
64 ) -> ProgramResult {
65 msg!("Beginning processing");
66 let instruction_tag = FromPrimitive::from_u8(instruction_data[0])
67 .ok_or(ProgramError::InvalidInstructionData)?;
68 let instruction_data = &instruction_data[INSTRUCTION_TAG_OFFSET..];
69
70 match instruction_tag {
71 DexInstruction::CreateMarket => {
72 msg!("Instruction: Create Market");
73 create_market::process(program_id, accounts, instruction_data)?;
74 }
75 DexInstruction::NewOrder => {
76 msg!("Instruction: New Order");
77 new_order::process(program_id, accounts, instruction_data)?;
78 }
79 DexInstruction::Swap => {
80 msg!("Instruction: Swap");
81 swap::process(program_id, accounts, instruction_data)?;
82 }
83 DexInstruction::ConsumeEvents => {
84 msg!("Instruction: Consume Events");
85 consume_events::process(program_id, accounts, instruction_data)?;
86 }
87 DexInstruction::CancelOrder => {
88 msg!("Instruction: Cancel Order");
89 cancel_order::process(program_id, accounts, instruction_data)?;
90 }
91 DexInstruction::Settle => {
92 msg!("Instruction: Settle");
93 settle::process(program_id, accounts)?;
94 }
95 DexInstruction::InitializeAccount => {
96 msg!("Instruction: Initialize account");
97 initialize_account::process(program_id, accounts, instruction_data)?;
98 }
99 DexInstruction::SweepFees => {
100 msg!("Instruction: Sweep fees");
101 sweep_fees::process(program_id, accounts)?;
102 }
103 DexInstruction::CloseAccount => {
104 msg!("Instruction: Close Account");
105 close_account::process(program_id, accounts)?;
106 }
107 DexInstruction::CloseMarket => {
108 msg!("Instruction: Close Market");
109 close_market::process(program_id, accounts)?
110 }
111 DexInstruction::UpdateRoyalties => {
112 msg!("Instruction: Update royalties");
113 update_royalties::process(program_id, accounts)?
114 }
115 }
116 Ok(())
117 }

Callers

nothing calls this directly

Calls 1

processFunction · 0.50

Tested by

no test coverage detected