Skip to content

Commit

Permalink
Fix params validation in cellarfees
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrit committed Nov 7, 2024
1 parent 36113b5 commit e48b362
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions x/cellarfees/types/v2/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ func (p *Params) ValidateBasic() error {
if err := validatePriceDecreaseBlockInterval(p.PriceDecreaseBlockInterval); err != nil {
return err
}
if err := validateAuctionInterval(p.AuctionInterval); err != nil {
return err
}
if err := validateAuctionThresholdUsdValue(p.AuctionThresholdUsdValue); err != nil {
return err
}

return nil
}

Expand All @@ -95,12 +102,12 @@ func validateInitialPriceDecreaseRate(i interface{}) error {
return errorsmod.Wrapf(types.ErrInvalidInitialPriceDecreaseRate, "initial price decrease rate: %T", i)
}

if rate == sdk.ZeroDec() {
return errorsmod.Wrapf(types.ErrInvalidInitialPriceDecreaseRate, "initial price decrease rate cannot be zero, must be 0 < x < 1")
if rate.LTE(sdk.ZeroDec()) {
return errorsmod.Wrapf(types.ErrInvalidInitialPriceDecreaseRate, "initial price decrease rate cannot be zero or negative,must be 0 < x < 1")
}

if rate == sdk.OneDec() {
return errorsmod.Wrapf(types.ErrInvalidInitialPriceDecreaseRate, "initial price decrease rate cannot be one, must be 0 < x < 1")
if rate.GTE(sdk.OneDec()) {
return errorsmod.Wrapf(types.ErrInvalidInitialPriceDecreaseRate, "initial price decrease rate cannot be one or greater, must be 0 < x < 1")
}

return nil
Expand Down

0 comments on commit e48b362

Please sign in to comment.