diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go index 0739838..5edf4c0 100644 --- a/x/auction/keeper/msg_server.go +++ b/x/auction/keeper/msg_server.go @@ -73,7 +73,12 @@ func (k msgServer) Bid(ctx context.Context, msg *types.MsgBid) (*types.MsgBidRes return nil, err } - recivePrice := math.LegacyMustNewDecFromStr(auction.InitialPrice).Mul(math.LegacyMustNewDecFromStr(msg.ReciveRate)) + reciveRate := math.LegacyMustNewDecFromStr(msg.ReciveRate) + params := k.GetParams(ctx) + if reciveRate.LT(math.LegacyMustNewDecFromStr(params.LowestRate)) || reciveRate.GT(math.LegacyMustNewDecFromStr(params.StartingRate)) { + return nil, fmt.Errorf("reciveRate must be greater than or equal to %s and less than or equal to %s", params.LowestRate, params.StartingRate) + } + recivePrice := math.LegacyMustNewDecFromStr(auction.InitialPrice).Mul(reciveRate) // auction.InitialPrice. bid := types.Bid{ BidId: newBidId, diff --git a/x/vaults/types/msgs.go b/x/vaults/types/msgs.go index 49eb7d9..cf3bf64 100644 --- a/x/vaults/types/msgs.go +++ b/x/vaults/types/msgs.go @@ -151,23 +151,23 @@ func (msg *MsgActiveCollateral) ValidateBasic() error { } if msg.LiquidationRatio.LT(math.LegacyZeroDec()) { - return fmt.Errorf("minCollateralRatio cannot be less than 0") + return fmt.Errorf("LiquidationRatio cannot be less than 0") } if msg.StabilityFee.LTE(math.LegacyZeroDec()) { return fmt.Errorf("StabilityFee cannot be less than 0") } - if msg.LiquidationPenalty.LT(math.LegacyZeroDec()) { - return fmt.Errorf("minCollateralRatio cannot be less than 0") + if msg.LiquidationPenalty.LTE(math.LegacyZeroDec()) { + return fmt.Errorf("LiquidationPenalty cannot be less than 0") } - if msg.MaxDebt.LT(math.ZeroInt()) { - return fmt.Errorf("minCollateralRatio cannot be less than 0") + if msg.MaxDebt.LTE(math.ZeroInt()) { + return fmt.Errorf("MaxDebt cannot be less than 0") } if msg.MintingFee.LT(math.LegacyZeroDec()) { - return fmt.Errorf("minCollateralRatio cannot be less than 0") + return fmt.Errorf("MintingFee cannot be less than 0") } return nil }