|
1 | 1 | package types |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "fmt" |
| 4 | + "errors" |
5 | 5 |
|
6 | | - "cosmossdk.io/errors" |
| 6 | + errorsmod "cosmossdk.io/errors" |
7 | 7 | "cosmossdk.io/math" |
8 | 8 |
|
9 | 9 | sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" |
@@ -40,41 +40,41 @@ func ValidateGenesis(gs *GenesisState) error { |
40 | 40 |
|
41 | 41 | func validateBudget(bp Budget) error { |
42 | 42 | if bp.RecipientAddress == "" { |
43 | | - return fmt.Errorf("recipient cannot be empty") |
| 43 | + return errors.New("recipient cannot be empty") |
44 | 44 | } |
45 | 45 |
|
46 | 46 | // Validate BudgetPerTranche |
47 | 47 | if bp.BudgetPerTranche == nil || bp.BudgetPerTranche.IsZero() { |
48 | | - return fmt.Errorf("budget per tranche cannot be zero") |
| 48 | + return errors.New("budget per tranche cannot be zero") |
49 | 49 | } |
50 | 50 | if err := bp.BudgetPerTranche.Validate(); err != nil { |
51 | | - return errors.Wrap(sdkerrors.ErrInvalidCoins, bp.BudgetPerTranche.String()) |
| 51 | + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, bp.BudgetPerTranche.String()) |
52 | 52 | } |
53 | 53 |
|
54 | 54 | if bp.TranchesLeft == 0 { |
55 | | - return fmt.Errorf("invalid budget proposal: tranches must be greater than zero") |
| 55 | + return errors.New("invalid budget proposal: tranches must be greater than zero") |
56 | 56 | } |
57 | 57 |
|
58 | 58 | if bp.Period == nil || *bp.Period == 0 { |
59 | | - return fmt.Errorf("invalid budget proposal: period length should be greater than zero") |
| 59 | + return errors.New("invalid budget proposal: period length should be greater than zero") |
60 | 60 | } |
61 | 61 | return nil |
62 | 62 | } |
63 | 63 |
|
64 | 64 | func validateContinuousFund(cf ContinuousFund) error { |
65 | 65 | if cf.Recipient == "" { |
66 | | - return fmt.Errorf("recipient cannot be empty") |
| 66 | + return errors.New("recipient cannot be empty") |
67 | 67 | } |
68 | 68 |
|
69 | 69 | // Validate percentage |
70 | 70 | if cf.Percentage.IsNil() || cf.Percentage.IsZero() { |
71 | | - return fmt.Errorf("percentage cannot be zero or empty") |
| 71 | + return errors.New("percentage cannot be zero or empty") |
72 | 72 | } |
73 | 73 | if cf.Percentage.IsNegative() { |
74 | | - return fmt.Errorf("percentage cannot be negative") |
| 74 | + return errors.New("percentage cannot be negative") |
75 | 75 | } |
76 | 76 | if cf.Percentage.GT(math.LegacyOneDec()) { |
77 | | - return fmt.Errorf("percentage cannot be greater than one") |
| 77 | + return errors.New("percentage cannot be greater than one") |
78 | 78 | } |
79 | 79 | return nil |
80 | 80 | } |
0 commit comments