Skip to main content

pumpfun_new_rust_sdk/errors/
pump.rs

1use num_derive::FromPrimitive;
2use thiserror::Error;
3
4#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
5pub enum PumpError {
6    #[error("The given account is not authorized to execute this instruction.")]
7    NotAuthorized = 0x1770,
8    #[error("The program is already initialized.")]
9    AlreadyInitialized = 0x1771,
10    #[error("slippage: Too much SOL required to buy the given amount of tokens.")]
11    TooMuchSolRequired = 0x1772,
12    #[error("slippage: Too little SOL received to sell the given amount of tokens.")]
13    TooLittleSolReceived = 0x1773,
14    #[error("The mint does not match the bonding curve.")]
15    MintDoesNotMatchBondingCurve = 0x1774,
16    #[error("The bonding curve has completed and liquidity migrated to raydium.")]
17    BondingCurveComplete = 0x1775,
18    #[error("The bonding curve has not completed.")]
19    BondingCurveNotComplete = 0x1776,
20    #[error("The program is not initialized.")]
21    NotInitialized = 0x1777,
22    #[error("Withdraw too frequent")]
23    WithdrawTooFrequent = 0x1778,
24    #[error("new_size should be > current_size")]
25    NewSizeShouldBeGreaterThanCurrentSize = 0x1779,
26    #[error("Account type not supported")]
27    AccountTypeNotSupported = 0x177A,
28    #[error("initial_real_token_reserves should be less than token_total_supply")]
29    InitialRealTokenReservesShouldBeLessThanTokenTotalSupply = 0x177B,
30    #[error("initial_virtual_token_reserves should be greater than initial_real_token_reserves")]
31    InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves = 0x177C,
32    #[error("fee_basis_points greater than maximum")]
33    FeeBasisPointsGreaterThanMaximum = 0x177D,
34    #[error("Withdraw authority cannot be set to System Program ID")]
35    AllZerosWithdrawAuthority = 0x177E,
36    #[error("pool_migration_fee should be less than final_real_sol_reserves")]
37    PoolMigrationFeeShouldBeLessThanFinalRealSolReserves = 0x177F,
38    #[error("pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES")]
39    PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees = 0x1780,
40    #[error("Migrate instruction is disabled")]
41    DisabledWithdraw = 0x1781,
42    #[error("Migrate instruction is disabled")]
43    DisabledMigrate = 0x1782,
44    #[error("Invalid creator pubkey")]
45    InvalidCreator = 0x1783,
46    #[error("Buy zero amount")]
47    BuyZeroAmount = 0x1784,
48    #[error("Not enough tokens to buy")]
49    NotEnoughTokensToBuy = 0x1785,
50    #[error("Sell zero amount")]
51    SellZeroAmount = 0x1786,
52    #[error("Not enough tokens to sell")]
53    NotEnoughTokensToSell = 0x1787,
54    #[error("Overflow")]
55    Overflow = 0x1788,
56    #[error("Truncation")]
57    Truncation = 0x1789,
58    #[error("Division by zero")]
59    DivisionByZero = 0x178A,
60    #[error("Not enough remaining accounts")]
61    NotEnoughRemainingAccounts = 0x178B,
62    #[error("All fee recipients should be non-zero")]
63    AllFeeRecipientsShouldBeNonZero = 0x178C,
64    #[error("Unsorted or not unique fee recipients")]
65    UnsortedNotUniqueFeeRecipients = 0x178D,
66    #[error("Creator should not be zero")]
67    CreatorShouldNotBeZero = 0x178E,
68    #[error("Start time in the past")]
69    StartTimeInThePast = 0x178F,
70    #[error("End time in the past")]
71    EndTimeInThePast = 0x1790,
72    #[error("End time before start time")]
73    EndTimeBeforeStartTime = 0x1791,
74    #[error("Time range too large")]
75    TimeRangeTooLarge = 0x1792,
76    #[error("End time before current day")]
77    EndTimeBeforeCurrentDay = 0x1793,
78    #[error("Supply update for finished range")]
79    SupplyUpdateForFinishedRange = 0x1794,
80    #[error("Day index after end index")]
81    DayIndexAfterEndIndex = 0x1795,
82    #[error("Day in active range")]
83    DayInActiveRange = 0x1796,
84    #[error("Invalid incentive mint")]
85    InvalidIncentiveMint = 0x1797,
86    #[error("Buy: Not enough SOL to cover for rent exemption.")]
87    BuyNotEnoughSolToCoverRent = 0x1798,
88    #[error("Buy: Not enough SOL to cover for fees.")]
89    BuyNotEnoughSolToCoverFees = 0x1799,
90    #[error("Slippage: Would buy less tokens than expected min_tokens_out")]
91    BuySlippageBelowMinTokensOut = 0x179A,
92    #[error("Name too long")]
93    NameTooLong = 0x179B,
94    #[error("Symbol too long")]
95    SymbolTooLong = 0x179C,
96    #[error("Uri too long")]
97    UriTooLong = 0x179D,
98    #[error("CreateV2 disabled")]
99    CreateV2Disabled = 0x179E,
100    #[error("CPI initialize mayhem failed")]
101    CpitializeMayhemFailed = 0x179F,
102    #[error("Mayhem mode disabled")]
103    MayhemModeDisabled = 0x17A0,
104    #[error("creator has been migrated to sharing config, use pump_fees::reset_fee_sharing_config instead")]
105    CreatorMigratedToSharingConfig = 0x17A1,
106    #[error("creator_vault has been migrated to sharing config, use pump:distribute_creator_fees instead")]
107    UnableToDistributeCreatorVaultMigratedToSharingConfig = 0x17A2,
108    #[error("Sharing config is not active")]
109    SharingConfigNotActive = 0x17A3,
110    #[error("The recipient account is executable, so it cannot receive lamports, remove it from the team first")]
111    UnableToDistributeCreatorFeesToExecutableRecipient = 0x17A4,
112    #[error("Bonding curve creator does not match sharing config")]
113    BondingCurveAndSharingConfigCreatorMismatch = 0x17A5,
114    #[error("Remaining accounts do not match shareholders, make sure to pass exactly the same pubkeys in the same order")]
115    ShareholdersAndRemainingAccountsMismatch = 0x17A6,
116    #[error("Share bps must be greater than 0")]
117    InvalidShareBps = 0x17A7,
118    #[error("Cashback is not enabled")]
119    CashbackNotEnabled = 0x17A8,
120}
121
122impl From<PumpError> for solana_program_error::ProgramError {
123    fn from(e: PumpError) -> Self {
124        solana_program_error::ProgramError::Custom(e as u32)
125    }
126}