1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use cosmwasm_std::{CheckedFromRatioError, Coin, StdError};
use cw_utils::{ParseReplyError, PaymentError};
use neutron_sdk::NeutronError;
use thiserror::Error;

/// This enum describes contract errors
#[derive(Error, Debug, PartialEq)]
pub enum ContractError {
    #[error("{0}")]
    Std(#[from] StdError),

    #[error("{0}")]
    PaymentError(#[from] PaymentError),

    #[error("{0}")]
    NeutronError(#[from] NeutronError),

    #[error("{0}")]
    ParseReplyError(#[from] ParseReplyError),

    #[error("{0}")]
    CheckedFromRatioError(#[from] CheckedFromRatioError),

    #[error("Unauthorized")]
    Unauthorized {},

    #[error("You can't vote with zero voting power")]
    ZeroVotingPower {},

    #[error("Next time you can change your vote is at {0}")]
    VoteCooldown(u64),

    #[error("Next tuning will be available at {0}")]
    TuneCooldown(u64),

    #[error("Pool {0} is not whitelisted")]
    PoolIsNotWhitelisted(String),

    #[error("Incorrect whitelist fee. Expected {0}")]
    IncorrectWhitelistFee(Coin),

    #[error("Pool {0} is already whitelisted")]
    PoolAlreadyWhitelisted(String),

    #[error("Invalid total votes weight. Must be 1")]
    InvalidTotalWeight {},

    #[error("Failed to parse reply")]
    FailedToParseReply {},

    #[error("Invalid outpost prefix for {0}")]
    InvalidOutpostPrefix(String),

    #[error("Invalid ASTRO denom for outpost. Must start with ibc/")]
    InvalidOutpostAstroDenom {},

    #[error("Invalid ASTRO denom on the Hub. Must be {0}")]
    InvalidHubAstroDenom(String),

    #[error("Invalid ics20 channel. Must start with channel-")]
    InvalidOutpostIcs20Channel {},

    #[error("Failed to determine outpost for pool {0}")]
    NoOutpostForPool(String),

    #[error("Message contains duplicated pools")]
    DuplicatedVotes {},

    #[error("Astro pool can't be whitelisted")]
    IsAstroPool {},

    #[error("No failed outposts to retry")]
    NoFailedOutpostsToRetry {},

    #[error("Can't set zero emissions for astro pool")]
    ZeroAstroEmissions {},

    #[error("Failed to migrate contract")]
    MigrationError {},
}