Skip to content

Commit

Permalink
address sam comments
Browse files Browse the repository at this point in the history
  • Loading branch information
asalzmann committed Sep 18, 2023
1 parent 66d2008 commit 643f720
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 23 deletions.
19 changes: 2 additions & 17 deletions x/stakeibc/client/cli/tx_update_inner_redemption_rate_bounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,8 @@ func CmdUpdateInnerRedemptionRateBounds() *cobra.Command {
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argChainId := args[0]
minRedemptionRateStr := args[1]
maxRedemptionRateStr := args[2]

minInnerRedemptionRate := sdk.ZeroDec()
if minRedemptionRateStr != "" {
minInnerRedemptionRate, err = sdk.NewDecFromStr(minRedemptionRateStr)
if err != nil {
return err
}
}
maxInnerRedemptionRate := sdk.ZeroDec()
if maxRedemptionRateStr != "" {
maxInnerRedemptionRate, err = sdk.NewDecFromStr(maxRedemptionRateStr)
if err != nil {
return err
}
}
minInnerRedemptionRate := sdk.MustNewDecFromStr(args[1])
maxInnerRedemptionRate := sdk.MustNewDecFromStr(args[2])

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ func (k msgServer) UpdateInnerRedemptionRateBounds(goCtx context.Context, msg *t
return nil, types.ErrInvalidBounds
}

// Confirm the max is greater than the min
if innerMaxSafetyThreshold.LTE(innerMinSafetyThreshold) {
k.Logger(ctx).Error(fmt.Sprintf("Inner max safety threshold (%s) is less than inner min safety threshold (%s)", innerMaxSafetyThreshold, innerMinSafetyThreshold))
return nil, types.ErrInvalidBounds
}

// Set the inner bounds on the host zone
zone.MinInnerRedemptionRate = innerMinSafetyThreshold
zone.MaxInnerRedemptionRate = innerMaxSafetyThreshold
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package keeper
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func (msg *MsgUpdateInnerRedemptionRateBounds) ValidateBasic() error {
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
// Confirm the max is greater than the min
if msg.MaxInnerRedemptionRate.LTE(msg.MaxInnerRedemptionRate) {
return errorsmod.Wrapf(ErrInvalidBounds, "Inner max safety threshold (%s) is less than inner min safety threshold (%s)", msg.MaxInnerRedemptionRate, msg.MinInnerRedemptionRate)
}
if err := utils.ValidateAdminAddress(msg.Creator); err != nil {
return err
}
Expand Down

0 comments on commit 643f720

Please sign in to comment.