1use cosmwasm_std::{Decimal, StdError, Uint128};
2use thiserror::Error;
3
4#[derive(Error, Debug, PartialEq)]
5pub enum ContractError {
6 #[error("{0}")]
7 Std(#[from] StdError),
8
9 #[error("{0}")]
10 Cw20Error(#[from] cw20_base::ContractError),
11
12 #[error("None Error")]
13 NoneError {},
14
15 #[error("Unauthorized")]
16 Unauthorized {},
17 #[error("Min liquidity error: requested: {min_liquidity}, available: {liquidity_available}")]
20 MinLiquidityError {
21 min_liquidity: Uint128,
22 liquidity_available: Uint128,
23 },
24
25 #[error("Max token error: max_token: {max_token}, tokens_required: {tokens_required}")]
26 MaxTokenError {
27 max_token: Uint128,
28 tokens_required: Uint128,
29 },
30
31 #[error("Insufficient liquidity error: requested: {requested}, available: {available}")]
32 InsufficientLiquidityError {
33 requested: Uint128,
34 available: Uint128,
35 },
36
37 #[error("Min token1 error: requested: {requested}, available: {available}")]
38 MinToken1Error {
39 requested: Uint128,
40 available: Uint128,
41 },
42
43 #[error("Min token2 error: requested: {requested}, available: {available}")]
44 MinToken2Error {
45 requested: Uint128,
46 available: Uint128,
47 },
48
49 #[error("Incorrect native denom: provided: {provided}, required: {required}")]
50 IncorrectNativeDenom { provided: String, required: String },
51
52 #[error("Swap min error: min: {min}, available: {available}")]
53 SwapMinError { min: Uint128, available: Uint128 },
54
55 #[error("MsgExpirationError")]
56 MsgExpirationError {},
57
58 #[error("Total fee ({total_fee_percent}) percent is higher than max ({max_fee_percent})")]
59 FeesTooHigh {
60 max_fee_percent: Decimal,
61 total_fee_percent: Decimal,
62 },
63
64 #[error("InsufficientFunds")]
65 InsufficientFunds {},
66
67 #[error("Uknown reply id: {id}")]
68 UnknownReplyId { id: u64 },
69
70 #[error("Failed to instantiate lp token")]
71 InstantiateLpTokenError {},
72
73 #[error("The output amm provided is invalid")]
74 InvalidOutputPool {},
75}