astroport_generator/
error.rs

1use cosmwasm_std::{OverflowError, StdError};
2use thiserror::Error;
3
4/// This enum describes generator contract errors
5#[derive(Error, Debug, PartialEq)]
6pub enum ContractError {
7    #[error("{0}")]
8    Std(#[from] StdError),
9
10    #[error("Unauthorized")]
11    Unauthorized {},
12
13    #[error("Insufficient balance in contract to process claim")]
14    BalanceTooSmall {},
15
16    #[error("Reward proxy not allowed!")]
17    RewardProxyNotAllowed {},
18
19    #[error("Pool doesn't have additional rewards!")]
20    PoolDoesNotHaveAdditionalRewards {},
21
22    #[error("Insufficient amount of orphan rewards!")]
23    ZeroOrphanRewards {},
24
25    #[error("Contract can't be migrated!")]
26    MigrationError {},
27
28    #[error("The pool already has a reward proxy contract!")]
29    PoolAlreadyHasRewardProxyContract {},
30
31    #[error("Generator is disabled!")]
32    GeneratorIsDisabled {},
33
34    #[error("Duplicate of pool")]
35    PoolDuplicate {},
36
37    #[error("Pair is not registered in factory!")]
38    PairNotRegistered {},
39
40    #[error("ASTRO or native assets cannot be blocked! You are trying to block {asset}")]
41    AssetCannotBeBlocked { asset: String },
42
43    #[error("Maximum generator limit exceeded!")]
44    GeneratorsLimitExceeded {},
45
46    #[error("You can not withdraw 0 LP tokens.")]
47    ZeroWithdraw {},
48
49    #[error("Failed to parse or process reply message")]
50    FailedToParseReply {},
51}
52
53impl From<OverflowError> for ContractError {
54    fn from(o: OverflowError) -> Self {
55        StdError::from(o).into()
56    }
57}