1use cosmwasm_std::{OverflowError, StdError};
2use cw2::VersionError;
3use cw_utils::PaymentError;
4use thiserror::Error;
5
6use astroport_governance::assembly::ProposalStatus;
7
8#[derive(Error, Debug, PartialEq)]
10pub enum ContractError {
11 #[error("{0}")]
12 Std(#[from] StdError),
13
14 #[error("{0}")]
15 OverflowError(#[from] OverflowError),
16
17 #[error("{0}")]
18 VersionError(#[from] VersionError),
19
20 #[error("Unauthorized")]
21 Unauthorized {},
22
23 #[error("Proposal not active!")]
24 ProposalNotActive {},
25
26 #[error("Voting period ended!")]
27 VotingPeriodEnded {},
28
29 #[error("User already voted!")]
30 UserAlreadyVoted {},
31
32 #[error("You don't have any voting power!")]
33 NoVotingPower {},
34
35 #[error("Voting period not ended yet!")]
36 VotingPeriodNotEnded {},
37
38 #[error("Insufficient token deposit!")]
39 InsufficientDeposit {},
40
41 #[error("Proposal not passed!")]
42 ProposalNotPassed {},
43
44 #[error("Proposal delay not ended!")]
45 ProposalDelayNotEnded {},
46
47 #[error("Whitelist cannot be empty!")]
48 WhitelistEmpty {},
49
50 #[error("Messages check passed. Nothing was committed to the blockchain")]
51 MessagesCheckPassed {},
52
53 #[error("IBC controller is not set")]
54 MissingIBCController {},
55
56 #[error(
57 "Failed to process callback from IBC controller as proposal {0} is not in \"{}\" state",
58 ProposalStatus::InProgress
59 )]
60 WrongIbcProposalStatus(String),
61
62 #[error("The IBC controller reports an invalid proposal status: {0}. Valid statuses: failed or executed ")]
63 InvalidRemoteIbcProposalStatus(String),
64
65 #[error("Sender is not an IBC controller installed in the assembly")]
66 InvalidIBCController {},
67
68 #[error("{0}")]
69 PaymentError(#[from] PaymentError),
70
71 #[error("Failed to migrate contract")]
72 MigrationError {},
73}