abstract_dex_standard/
error.rs

1use abstract_adapter::AdapterError;
2use abstract_sdk::AbstractSdkError;
3use abstract_std::{
4    objects::{ans_host::AnsHostError, DexAssetPairing},
5    AbstractError,
6};
7use cosmwasm_std::StdError;
8use cw_asset::AssetError;
9use thiserror::Error;
10
11#[derive(Error, Debug, PartialEq)]
12pub enum DexError {
13    #[error(transparent)]
14    Std(#[from] StdError),
15
16    #[error(transparent)]
17    AbstractOs(#[from] AbstractError),
18
19    #[error(transparent)]
20    AbstractSdk(#[from] AbstractSdkError),
21
22    #[error(transparent)]
23    Asset(#[from] AssetError),
24
25    #[error(transparent)]
26    AdapterError(#[from] AdapterError),
27
28    #[error(transparent)]
29    AnsHostError(#[from] AnsHostError),
30
31    #[error("DEX {dex} is not a known dex on this network ({:?}).", chain)]
32    UnknownDexOnThisPlatform { dex: String, chain: Option<String> },
33
34    #[error("DEX {0} is not a known dex by Abstract")]
35    UnknownDex(String),
36
37    #[error("DEX {0} is not local to this network.")]
38    ForeignDex(String),
39
40    #[error("Asset type: {0} is unsupported.")]
41    UnsupportedAssetType(String),
42
43    #[error("Can't provide liquidity with less than two assets")]
44    TooFewAssets {},
45
46    #[error("Can't provide liquidity with more than {0} assets")]
47    TooManyAssets(u8),
48
49    #[error("Provided asset {0} not in pool with assets {1:?}.")]
50    ArgumentMismatch(String, Vec<String>),
51
52    #[error("Balancer pool not supported for dex {0}.")]
53    BalancerNotSupported(String),
54
55    #[error("Pair {0} on DEX {1} does not match with pair address {2}")]
56    DexMismatch(String, String, String),
57
58    #[error("Not implemented for dex {0}")]
59    NotImplemented(String),
60
61    #[error("Maximum spread {0} exceeded for dex {1}")]
62    MaxSlippageAssertion(String, String),
63
64    #[error("Message generation for IBC queries not supported.")]
65    IbcMsgQuery,
66
67    #[error("Asset pairing {} not found.", asset_pairing)]
68    AssetPairingNotFound { asset_pairing: DexAssetPairing },
69
70    #[error("Invalid Generate Message")]
71    InvalidGenerateMessage,
72
73    #[error("Pool address not specified. You need to specify it when using raw asset addresses or denom")]
74    PoolAddressEmpty,
75
76    #[error("Only account of abstract namespace can update configuration")]
77    Unauthorized {},
78}