anone_minter/
error.rs

1use cosmwasm_std::{Coin, StdError, Timestamp};
2use cw_utils::PaymentError;
3use thiserror::Error;
4use url::ParseError;
5
6#[derive(Error, Debug, PartialEq)]
7pub enum ContractError {
8    #[error("{0}")]
9    Std(#[from] StdError),
10
11    #[error("Unauthorized: {0}")]
12    Unauthorized(String),
13
14    #[error("Invalid reply ID")]
15    InvalidReplyID {},
16
17    #[error("Not enough funds sent")]
18    NotEnoughFunds {},
19
20    #[error("TooManyCoins")]
21    TooManyCoins {},
22
23    #[error("IncorrectPaymentAmount {0} != {1}")]
24    IncorrectPaymentAmount(Coin, Coin),
25
26    #[error("InvalidNumTokens {max}, min: 1")]
27    InvalidNumTokens { max: u32, min: u32 },
28
29    #[error("Sold out")]
30    SoldOut {},
31
32    #[error("InvalidDenom {expected} got {got}")]
33    InvalidDenom { expected: String, got: String },
34
35    #[error("Minimum network mint price {expected} got {got}")]
36    InsufficientMintPrice { expected: u128, got: u128 },
37
38    #[error("Invalid address {addr}")]
39    InvalidAddress { addr: String },
40
41    #[error("Invalid token id")]
42    InvalidTokenId {},
43
44    #[error("AlreadyStarted")]
45    AlreadyStarted {},
46
47    #[error("InvalidStartTime {0} < {1}")]
48    InvalidStartTime(Timestamp, Timestamp),
49
50    #[error("Instantiate an721 error")]
51    InstantiateAn721Error {},
52
53    #[error("Invalid base token URI (must be an IPFS URI)")]
54    InvalidBaseTokenURI {},
55
56    #[error("Minting has not started yet")]
57    BeforeMintStartTime {},
58
59    #[error("Invalid minting limit per address. max: {max}, min: 1, got: {got}")]
60    InvalidPerAddressLimit { max: u32, min: u32, got: u32 },
61
62    #[error("Max minting limit per address exceeded")]
63    MaxPerAddressLimitExceeded {},
64
65    #[error("Token id: {token_id} already sold")]
66    TokenIdAlreadySold { token_id: u32 },
67
68    #[error("ZeroBalance")]
69    ZeroBalance {},
70
71    #[error("{0}")]
72    Payment(#[from] PaymentError),
73}
74
75impl From<ParseError> for ContractError {
76    fn from(_err: ParseError) -> ContractError {
77        ContractError::InvalidBaseTokenURI {}
78    }
79}