#![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 SendNexusError {
#[error("Insufficient stake balance")]
InsufficientStake = 0x1770,
#[error("Invalid reward mint")]
InvalidRewardMint = 0x1771,
#[error("Invalid vault")]
InvalidVault = 0x1772,
#[error("Staking already enabled")]
StakingAlreadyEnabled = 0x1775,
#[error("Staking not enabled")]
StakingNotEnabled = 0x1776,
#[error("Invalid staking mint")]
InvalidStakingMint = 0x1777,
#[error("Invalid reward state")]
InvalidRewardState = 0x1778,
#[error("Invalid mint")]
InvalidMint = 0x1779,
#[error("Invalid destination account")]
InvalidDestination = 0x177A,
#[error("Staking mint already bound")]
StakingMintAlreadyBound = 0x177B,
#[error("Invalid fee configuration")]
InvalidFeePreset = 0x177C,
#[error("Invalid preset index")]
InvalidPresetIndex = 0x177D,
#[error("Must provide either fee_preset or custom fees")]
MissingFeeSource = 0x177E,
#[error("Cannot specify both fee_preset and custom_fees")]
AmbiguousFeeSource = 0x177F,
#[error("Partner name cannot be empty")]
InvalidPartnerName = 0x1780,
#[error("Partner account does not use this preset")]
PartnerNotOnPreset = 0x1781,
#[error("Invalid partner note")]
InvalidPartnerNote = 0x1782,
#[error("Invalid preset name")]
InvalidPresetName = 0x1783,
#[error("Too many auth platforms (max 255)")]
TooManyAuthPlatforms = 0x1784,
#[error("Invalid auth platform index")]
InvalidAuthPlatformIndex = 0x1785,
#[error("Invalid auth platform name")]
InvalidAuthPlatformName = 0x1786,
#[error("Duplicate auth platform name")]
DuplicateAuthPlatformName = 0x1787,
#[error("Invalid authority")]
InvalidAuthority = 0x1788,
#[error("Cannot add the default partner")]
ReservedPartner = 0x1789,
#[error("Invalid reward accrual")]
InvalidRewardAccrual = 0x178A,
#[error(
"Settle every reward mint before staking or unstaking - call settle for each registered mint"
)]
RewardsNotSettled = 0x178B,
#[error("USDC price must be non-zero - 0 means no price")]
InvalidUsdcPrice = 0x178C,
#[error("Platform config cannot be the default address")]
InvalidPlatformConfig = 0x178D,
#[error("Partner config address does not match its stored seeds")]
InvalidPartnerConfig = 0x178E,
#[error("Fee preset belongs to a different platform")]
PresetPlatformMismatch = 0x178F,
#[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("Unused")]
Unused7012 = 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("Creator fee exceeds the partner's maximum")]
CreatorFeeTooHigh = 0x1B67,
#[error("Creator fee mode is not allowed by the partner config")]
CreatorFeeModeNotAllowed = 0x1B68,
#[error("Insufficient liquidity")]
InsufficientLiquidity = 0x1BBC,
#[error("Invalid amount")]
InvalidAmount = 0x1BBD,
}
impl From<SendNexusError> for solana_program::program_error::ProgramError {
fn from(e: SendNexusError) -> Self {
solana_program::program_error::ProgramError::Custom(e as u32)
}
}