cw_vesting/
error.rs

1use cosmwasm_std::{StdError, Uint128};
2use cw_denom::DenomError;
3use cw_ownable::OwnershipError;
4use cw_utils::PaymentError;
5use thiserror::Error;
6use wynd_utils::CurveError;
7
8#[derive(Error, Debug, PartialEq)]
9pub enum ContractError {
10    #[error(transparent)]
11    Std(#[from] StdError),
12
13    #[error(transparent)]
14    Curve(#[from] CurveError),
15
16    #[error(transparent)]
17    Denom(#[from] DenomError),
18
19    #[error(transparent)]
20    Ownable(#[from] OwnershipError),
21
22    #[error("{0}")]
23    PaymentError(#[from] PaymentError),
24
25    #[error("vesting curve values be in [0, total]`. got [{min}, {max}]")]
26    VestRange { min: Uint128, max: Uint128 },
27
28    #[error("vesting contract vests ({expected}) tokens, funded with ({sent})")]
29    WrongFundAmount { sent: Uint128, expected: Uint128 },
30
31    #[error("sent wrong cw20")]
32    WrongCw20,
33
34    #[error("total amount to vest must be non-zero")]
35    ZeroVest,
36
37    #[error("this vesting contract would complete instantly")]
38    Instavest,
39
40    #[error("can not vest a constant amount, specifiy two or more points")]
41    ConstantVest,
42
43    #[error("payment is cancelled")]
44    Cancelled,
45
46    #[error("payment is not cancelled")]
47    NotCancelled,
48
49    #[error("vesting contract is not distributing funds")]
50    NotFunded,
51
52    #[error("it should not be possible for a slash to occur in the unfunded state")]
53    UnfundedSlash,
54
55    #[error("vesting contract has already been funded")]
56    Funded,
57
58    #[error("only the vest receiver may perform this action")]
59    NotReceiver,
60
61    #[error("vesting denom may not be staked")]
62    NotStakeable,
63
64    #[error("no delegation to validator {0}")]
65    NoDelegation(String),
66
67    #[error("slash amount can not be zero")]
68    NoSlash,
69
70    #[error("can't set wihtdraw address to vesting contract")]
71    SelfWithdraw,
72
73    #[error("can't redelegate funds that are not immediately redelegatable. max: ({max})")]
74    NonImmediateRedelegate { max: Uint128 },
75
76    #[error("request must be <= claimable and > 0. !(0 < {request} <= {claimable})")]
77    InvalidWithdrawal {
78        request: Uint128,
79        claimable: Uint128,
80    },
81
82    #[error("can't register a slash event occuring in the future")]
83    FutureSlash,
84}