dloom_flow/
errors.rs

1// FILE: errors.rs
2
3use anchor_lang::prelude::*;
4
5#[error_code]
6pub enum DloomError {
7    #[msg("The provided fee rates are invalid.")]
8    InvalidFeeRates,
9    #[msg("The provided fee and bin_step parameters are not on the whitelist.")]
10    InvalidParameters,
11    #[msg("The mint addresses are not in the correct canonical order. Token A must be less than Token B.")]
12    InvalidMintOrder,
13    #[msg("The provided mint does not match the pool's mint.")]
14    InvalidMint,
15    #[msg("The lower bin ID must be less than the upper bin ID.")]
16    InvalidBinRange,
17    #[msg("Liquidity to deposit must be greater than zero.")]
18    ZeroLiquidity,
19    #[msg("The market price moved unfavorably, exceeding your slippage tolerance.")]
20    SlippageExceeded,
21    #[msg("The signer is not the authorized owner of this position.")]
22    Unauthorized,
23    #[msg("The amount of liquidity to remove exceeds the amount in the position.")]
24    InsufficientLiquidity,
25    #[msg("Cannot operate on a position that has no liquidity.")]
26    PositionNotEmpty,
27    #[msg("Input amount for a swap must be greater than zero.")]
28    ZeroAmount,
29    #[msg("The provided vault account does not match the pool's vault.")]
30    InvalidVault,
31    #[msg("The provided bin IDs must be a multiple of the pool's bin_step.")]
32    InvalidBinId,
33    #[msg("The specified bin range is wider than the allowed maximum.")]
34    RangeTooWide,
35    #[msg("Math operation overflowed or underflowed.")]
36    MathOverflow,
37    #[msg("The provided bin step value is invalid (e.g., zero).")]
38    InvalidBinStep,
39    #[msg("Not enough liquidity in the pool to complete the swap.")]
40    InsufficientLiquidityForSwap,
41    #[msg("The number of bins provided does not match the position's range.")]
42    InvalidBinCount,
43    #[msg("A provided bin account does not have the expected address.")]
44    InvalidBinAccount,
45    #[msg("The provided position account does not belong to the specified pool.")]
46    InvalidPool,
47    #[msg("The list of provided bin accounts does not match the cached list in the TransactionBins account.")]
48    BinCacheMismatch,
49    #[msg("The last update was too recent. Please wait before triggering another update.")]
50    UpdateNotNeeded,
51    #[msg("The selected fee preference does not permit this action.")]
52    InvalidFeePreference,
53    #[msg("The sum of protocol and referrer fee shares cannot exceed 100%.")]
54    FeeShareExceedsTotal,
55    #[msg("The trader cannot be the referrer.")]
56    ReferrerIsTrader,
57}