1use cosmwasm_std::{OverflowError, StdError};
2use thiserror::Error;
3use wynd_utils::CurveError;
4
5#[derive(Error, Debug, PartialEq)]
6pub enum ContractError {
7 #[error("{0}")]
8 Std(#[from] StdError),
9
10 #[error("{0}")]
11 Curve(#[from] CurveError),
12
13 #[error("Unauthorized")]
14 Unauthorized {},
15
16 #[error("Name is not in the expected format (3-50 UTF-8 bytes)")]
17 InvalidName,
18
19 #[error("Ticker symbol is not in expected format [a-zA-Z\\-]{{3,12}}")]
20 InvalidSymbol,
21
22 #[error("Decimals must not exceed 18")]
23 TooManyDecimals,
24
25 #[error("Cannot set to own account")]
26 CannotSetOwnAccount {},
27
28 #[error("Invalid zero amount")]
29 InvalidZeroAmount {},
30
31 #[error("Allowance is expired")]
32 Expired {},
33
34 #[error("No allowance for this account")]
35 NoAllowance {},
36
37 #[error("Minting cannot exceed the cap")]
38 CannotExceedCap {},
39
40 #[error("Logo binary data exceeds 5KB limit")]
41 LogoTooBig {},
42
43 #[error("Invalid xml preamble for SVG")]
44 InvalidXmlPreamble {},
45
46 #[error("Invalid png header")]
47 InvalidPngHeader {},
48
49 #[error("Duplicate initial balance addresses")]
50 DuplicateInitialBalanceAddresses {},
51
52 #[error("The transfer will never become fully vested. Must hit 0 eventually")]
53 NeverFullyVested,
54
55 #[error("The transfer tries to vest more tokens than it sends")]
56 VestsMoreThanSent,
57
58 #[error("The given account already has a vesting schedule associated with it")]
59 AlreadyVesting,
60
61 #[error("The transfer would have moved tokens still locked by a vesting schedule")]
62 CantMoveVestingTokens,
63
64 #[error("Address Not Found")]
65 AddressNotFound {},
66
67 #[error("Address Already Exist")]
68 AddressAlreadyExist {},
69
70 #[error("At least one Address must be on the Allow List")]
71 AtLeastOneAddressMustExist {},
72}
73
74impl From<OverflowError> for ContractError {
75 fn from(err: OverflowError) -> Self {
76 ContractError::Std(err.into())
77 }
78}