stable_swap/
entrypoint.rs

1//! Program entrypoint definitions
2#![cfg(not(feature = "no-entrypoint"))]
3
4use crate::{error::SwapError, processor::Processor};
5use solana_program::{
6    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
7    program_error::PrintProgramError, pubkey::Pubkey,
8};
9
10entrypoint!(process_instruction);
11fn process_instruction<'a>(
12    program_id: &Pubkey,
13    accounts: &'a [AccountInfo<'a>],
14    instruction_data: &[u8],
15) -> ProgramResult {
16    if let Err(error) = Processor::process(program_id, accounts, instruction_data) {
17        // catch the error so we can print it
18        error.print::<SwapError>();
19        return Err(error);
20    }
21    Ok(())
22}