entrypoint.rs 630 B

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