croncat_manager/
error.rs

1use cosmwasm_std::StdError;
2use croncat_sdk_manager::SdkError;
3use cw_utils::ParseReplyError;
4use thiserror::Error;
5
6#[derive(Error, Debug, PartialEq)]
7pub enum ContractError {
8    #[error("{0}")]
9    Std(#[from] StdError),
10
11    #[error("{0}")]
12    Sdk(#[from] SdkError),
13
14    #[error(transparent)]
15    ParseReplyError(#[from] ParseReplyError),
16
17    #[error("Account is either not a registered agent or is not active yet")]
18    AgentNotActive {},
19
20    #[error("No coin balance found")]
21    EmptyBalance {},
22
23    #[error("Invalid gas_price")]
24    InvalidGasPrice {},
25
26    #[error("Unauthorized")]
27    Unauthorized {},
28
29    #[error("Unauthorized method, restricted to owner or not allowed")]
30    UnauthorizedMethod {},
31
32    #[error("Invalid Pause Admin")]
33    InvalidPauseAdmin,
34
35    #[error("Contract is in paused state")]
36    ContractPaused,
37
38    #[error("Contract is in unpaused state")]
39    ContractUnpaused,
40
41    #[error("Must not attach funds of this coin denom")]
42    RedundantFunds {},
43
44    #[error(
45        "Invalid attached coins. Coins are limited to native and ibc coins configured by owner"
46    )]
47    InvalidAttachedCoins {},
48
49    #[error("Task balance is empty cannot continue")]
50    TaskBalanceEmpty {},
51
52    #[error("Unknown task hash")]
53    NoTaskHash {},
54
55    #[error("Invalid version key, please update it")]
56    InvalidKey {},
57
58    #[error("Agent doesn't have to do a task in this slot")]
59    NoTaskForAgent {},
60
61    #[error("No tasks to be done in this slot")]
62    NoTask {},
63
64    // Note: this should never happen unless agent_fee + treasury_fee got compromised
65    #[error("Invalid gas calculation")]
66    InvalidGasCalculation {},
67
68    #[error("No rewards available for withdraw")]
69    NoWithdrawRewardsAvailable {},
70
71    #[error("No rewards owner agent found")]
72    NoRewardsOwnerAgentFound {},
73
74    #[error("Task is no longer valid")]
75    TaskNoLongerValid {},
76
77    #[error("Task is not ready yet")]
78    TaskNotReady {},
79
80    #[error("Task transform is either looking at wrong indices or has malformed pointers")]
81    TaskInvalidTransform {},
82
83    #[error("Task transform is unsupported type")]
84    TaskTransformUnsupported {},
85
86    #[error("Task query result says not ready yet")]
87    TaskQueryResultFalse {},
88
89    #[error("This cw20 address is not supported")]
90    NotSupportedCw20 {},
91
92    #[error("Must provide percentage value (0 - 10,000) for field: {field}")]
93    InvalidPercentage { field: String },
94}