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
use cosmwasm_std::{OverflowError, StdError};
use cw2::VersionError;
use cw_utils::PaymentError;
use thiserror::Error;

use astroport_governance::assembly::ProposalStatus;

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

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

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

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

    #[error("Proposal not active!")]
    ProposalNotActive {},

    #[error("Voting period ended!")]
    VotingPeriodEnded {},

    #[error("User already voted!")]
    UserAlreadyVoted {},

    #[error("You don't have any voting power!")]
    NoVotingPower {},

    #[error("Voting period not ended yet!")]
    VotingPeriodNotEnded {},

    #[error("Insufficient token deposit!")]
    InsufficientDeposit {},

    #[error("Proposal not passed!")]
    ProposalNotPassed {},

    #[error("Proposal delay not ended!")]
    ProposalDelayNotEnded {},

    #[error("Whitelist cannot be empty!")]
    WhitelistEmpty {},

    #[error("Messages check passed. Nothing was committed to the blockchain")]
    MessagesCheckPassed {},

    #[error("IBC controller is not set")]
    MissingIBCController {},

    #[error(
        "Failed to process callback from IBC controller as proposal {0} is not in \"{}\" state",
        ProposalStatus::InProgress
    )]
    WrongIbcProposalStatus(String),

    #[error("The IBC controller reports an invalid proposal status: {0}. Valid statuses: failed or executed ")]
    InvalidRemoteIbcProposalStatus(String),

    #[error("Sender is not an IBC controller installed in the assembly")]
    InvalidIBCController {},

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

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