#![allow(
clippy::all,
clippy::pedantic,
clippy::nursery,
clippy::expect_used,
clippy::unwrap_used,
clippy::indexing_slicing,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::mem_forget,
unfulfilled_lint_expectations,
unexpected_cfgs,
unused_imports
)]
use num_derive::FromPrimitive;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum SendDexError {
#[error("Pool is paused")]
PoolPaused = 0x1770,
#[error("Slippage tolerance exceeded")]
SlippageExceeded = 0x1771,
#[error("Insufficient balance in source account")]
InsufficientBalance = 0x1772,
#[error("Invalid base mint")]
InvalidBaseMint = 0x1773,
#[error("Invalid quote mint")]
InvalidQuoteMint = 0x1774,
#[error("Pool creation is disabled")]
PoolCreationDisabled = 0x1775,
#[error("Invalid pool state")]
InvalidPoolState = 0x1776,
#[error("Invalid deposit")]
InvalidDeposit = 0x1777,
#[error("Invalid pool balance")]
InvalidPoolBalance = 0x1778,
#[error("Insufficient pool balance")]
InsufficientPoolBalance = 0x1779,
#[error("Invalid authority")]
InvalidAuthority = 0x177A,
#[error("creator_hash does not match (creator_platform, creator_id)")]
InvalidCreatorHash = 0x177B,
#[error("Platform config cannot be the default address")]
InvalidPlatformConfig = 0x177C,
#[error("Program is paused")]
ProgramPaused = 0x1B58,
#[error("Unauthorized")]
Unauthorized = 0x1B59,
#[error("Arithmetic overflow")]
ArithmeticOverflow = 0x1B5A,
#[error("Invalid Pyth price account")]
InvalidPythAccount = 0x1B5B,
#[error("Invalid Pyth feed ID")]
InvalidPythFeed = 0x1B5C,
#[error(
"Invalid slug: must be non-empty, <= max_len bytes, lowercase alphanumeric or underscore"
)]
InvalidSlug = 0x1B5D,
#[error("Text too long")]
TextTooLong = 0x1B5E,
#[error("User token account owned by the wrong token program")]
UserTokenAccountWrongProgram = 0x1B5F,
#[error("User token account is not an initialized token account")]
UserTokenAccountInvalid = 0x1B60,
#[error("User token account mint does not match the trade")]
UserTokenAccountWrongMint = 0x1B61,
#[error("User token account is not owned by the trading user")]
UserTokenAccountWrongAuthority = 0x1B62,
#[error("Nothing to claim")]
NothingToClaim = 0x1B63,
#[error("Creator identity is not a decodable wallet address")]
InvalidCreatorId = 0x1B64,
#[error("Quote mint has no USDC price on its nexus reward state")]
QuoteMintPriceUnset = 0x1B65,
#[error("Token-2022 transfer fee schedule cannot settle the exact amount")]
TransferFeeNotSettleable = 0x1B66,
#[error("Insufficient liquidity")]
InsufficientLiquidity = 0x1BBC,
#[error("Invalid amount")]
InvalidAmount = 0x1BBD,
}
impl From<SendDexError> for solana_program::program_error::ProgramError {
fn from(e: SendDexError) -> Self {
solana_program::program_error::ProgramError::Custom(e as u32)
}
}