kabu_defi_uniswap_v3_math/
error.rs1use alloy::primitives::ruint::ParseError;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
6pub enum UniswapV3MathError {
7 #[error("Denominator is 0")]
8 DenominatorIsZero,
9 #[error("Result is U256::MAX")]
10 ResultIsU256MAX,
11 #[error("Sqrt price is 0")]
12 SqrtPriceIsZero,
13 #[error("Sqrt price is less than or equal to quotient")]
14 SqrtPriceIsLteQuotient,
15 #[error("Can not get most significant bit or least significant bit on zero value")]
16 ZeroValue,
17 #[error("Liquidity is 0")]
18 LiquidityIsZero,
19 #[error("require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);")]
21 ProductDivAmount,
22 #[error("Denominator is less than or equal to prod_1")]
23 DenominatorIsLteProdOne,
24 #[error("Liquidity Sub")]
25 LiquiditySub,
26 #[error("Liquidity Add")]
27 LiquidityAdd,
28 #[error("The given tick must be less than, or equal to, the maximum tick")]
29 T,
30 #[error("Second inequality must be < because the price can never reach the price at the max tick")]
31 R,
32 #[error("Overflow when casting to U160")]
33 SafeCastToU160Overflow,
34 #[error("Tick spacing error")]
35 TickSpacingError,
36 #[error("Middleware error when getting next_initialized_tick_within_one_word")]
37 MiddlewareError(String),
38 #[error("Parse error")]
39 ParseError(#[from] ParseError),
40}