vending_minter/
error.rs

1use cosmwasm_std::{Coin, StdError, Timestamp};
2use cw_utils::PaymentError;
3use sg1::FeeError;
4use thiserror::Error;
5use url::ParseError;
6#[derive(Error, Debug, PartialEq)]
7pub enum ContractError {
8    #[error("{0}")]
9    Std(#[from] StdError),
10
11    #[error("{0}")]
12    Payment(#[from] PaymentError),
13
14    #[error("{0}")]
15    ParseError(#[from] ParseError),
16
17    #[error("{0}")]
18    Fee(#[from] FeeError),
19
20    #[error("Unauthorized: {0}")]
21    Unauthorized(String),
22
23    #[error("UpdateStatus")]
24    UpdateStatus {},
25
26    #[error("Invalid reply ID")]
27    InvalidReplyID {},
28
29    #[error("Not enough funds sent")]
30    NotEnoughFunds {},
31
32    #[error("TooManyCoins")]
33    TooManyCoins {},
34
35    #[error("IncorrectPaymentAmount {0} != {1}")]
36    IncorrectPaymentAmount(Coin, Coin),
37
38    #[error("InvalidNumTokens {max}, min: 1")]
39    InvalidNumTokens { max: u32, min: u32 },
40
41    #[error("Sold out")]
42    SoldOut {},
43
44    #[error("Not sold out")]
45    NotSoldOut {},
46
47    #[error("InvalidDenom {expected} got {got}")]
48    InvalidDenom { expected: String, got: String },
49
50    #[error("Minimum network mint price {expected} got {got}")]
51    InsufficientMintPrice { expected: u128, got: u128 },
52
53    #[error("Minimum whitelist mint price {expected} got {got}")]
54    InsufficientWhitelistMintPrice { expected: u128, got: u128 },
55
56    #[error("Update price {updated} higher than allowed price {allowed}")]
57    UpdatedMintPriceTooHigh { allowed: u128, updated: u128 },
58
59    #[error("Discount price can only be updated every 12 hours")]
60    DiscountUpdateTooSoon {},
61
62    #[error("Discount price can only be removed 1 hour after the last update")]
63    DiscountRemovalTooSoon {},
64
65    #[error("Invalid address {addr}")]
66    InvalidAddress { addr: String },
67
68    #[error("Invalid token id")]
69    InvalidTokenId {},
70
71    #[error("AlreadyStarted")]
72    AlreadyStarted {},
73
74    #[error("BeforeGenesisTime")]
75    BeforeGenesisTime {},
76
77    #[error("WhitelistAlreadyStarted")]
78    WhitelistAlreadyStarted {},
79
80    #[error("InvalidStartTime {0} < {1}")]
81    InvalidStartTime(Timestamp, Timestamp),
82
83    #[error("InvalidStartTradingTime {0} > {1}")]
84    InvalidStartTradingTime(Timestamp, Timestamp),
85
86    #[error("Instantiate sg721 error")]
87    InstantiateSg721Error {},
88
89    #[error("Invalid base token URI (must be an IPFS URI)")]
90    InvalidBaseTokenURI {},
91
92    #[error("address not on whitelist: {addr}")]
93    NotWhitelisted { addr: String },
94
95    #[error("Minting has not started yet")]
96    BeforeMintStartTime {},
97
98    #[error("Invalid minting limit per address. max: {max}, min: 1, got: {got}")]
99    InvalidPerAddressLimit { max: u32, min: u32, got: u32 },
100
101    #[error("Max minting limit per address exceeded")]
102    MaxPerAddressLimitExceeded {},
103
104    #[error("Token id: {token_id} already sold")]
105    TokenIdAlreadySold { token_id: u32 },
106
107    #[error("NoEnvTransactionIndex")]
108    NoEnvTransactionIndex {},
109
110    #[error("Multiply Fraction Error")]
111    CheckedMultiplyFractionError {},
112}