use num_derive::FromPrimitive;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum TunaStakingError {
#[error("Invalid instruction arguments")]
InvalidInstructionArguments = 0x1770,
#[error("Insufficient remaining accounts")]
RemainingAccountsInsufficient = 0x1771,
#[error("Math overflow")]
MathOverflow = 0x1772,
#[error("Math underflow")]
MathUnderflow = 0x1773,
#[error("Type cast overflow")]
TypeCastOverflow = 0x1774,
#[error("Transfer fee calculation failed")]
TransferFeeCalculationError = 0x1775,
#[error("Token mint has unsupported attributes")]
UnsupportedTokenMint = 0x1776,
#[error("Withdraw request exceeds user balance")]
WithdrawRequestExceedsUserBalance = 0x1777,
#[error("Tokens can't be unstaked because the cooldown has not expired")]
CooldownNotExpired = 0x1778,
#[error("Nothing to stake")]
NothingToStake = 0x1779,
#[error("Nothing to compound")]
NothingToCompound = 0x177A,
#[error("Nothing to deposit")]
NothingToDeposit = 0x177B,
#[error("Nothing to withdraw")]
NothingToWithdraw = 0x177C,
#[error("Nothing to swap")]
NothingToSwap = 0x177D,
#[error("Nothing staked")]
NothingStaked = 0x177E,
#[error("Staked token are locked")]
StakedTokensLocked = 0x177F,
#[error("Staking is disabled")]
StakingDisabled = 0x1780,
#[error("Unstaking is disabled")]
UnstakingDisabled = 0x1781,
#[error("Withdraw is disabled")]
WithdrawDisabled = 0x1782,
}
impl solana_program_error::PrintProgramError for TunaStakingError {
fn print<E>(&self) {
solana_msg::msg!(&self.to_string());
}
}
impl<T> solana_decode_error::DecodeError<T> for TunaStakingError {
fn type_of() -> &'static str {
"TunaStakingError"
}
}