Skip to content

Commit

Permalink
Merge pull request #85 from onomyprotocol/dong/validate-msg-vaults
Browse files Browse the repository at this point in the history
vaults: Add validate StabilityFee
  • Loading branch information
DongLieu authored Nov 7, 2024
2 parents 765d1a9 + 16835b5 commit 10140e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions x/vaults/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ func (msg *MsgActiveCollateral) ValidateBasic() error {
return fmt.Errorf("minCollateralRatio 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")
}
Expand Down Expand Up @@ -174,6 +178,10 @@ func (msg *MsgUpdatesCollateral) ValidateBasic() error {
return fmt.Errorf("minCollateralRatio 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")
}
Expand Down
1 change: 0 additions & 1 deletion x/vaults/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var (
DefaultLiquidationPenalty = math.LegacyMustNewDecFromStr("0.05")
DefaultMinInitialDebt = math.NewInt(50_000_000)
DefaultRecalculateDebtPeriod = time.Hour
DefaultLiquidatePeriod = time.Hour
DefaultMintDenom = []string{"nomUSD"}

KeyMintingFee = []byte("MintingFee")
Expand Down

0 comments on commit 10140e7

Please sign in to comment.