Skip to content

Commit

Permalink
Include more validations
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulBernal committed Mar 22, 2024
1 parent c2e1b34 commit 905d8f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/burn/types/message_burn_coins_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func (msg *MsgBurnCoinsAction) GetSignBytes() []byte {
return sdk.MustSortJSON(bz)
}

func (msg *MsgBurnCoinsAction) ValidateBasic() error { // TODO call IsValid and IsAllPositive
func (msg *MsgBurnCoinsAction) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return fmt.Errorf("invalid creator address: %v: %w", err, errors.New("invalid address"))
}
if msg.Amount.IsNegative() || msg.Amount.IsZero() {
return fmt.Errorf("amount must be positive")
if msg.Amount.IsNegative() || msg.Amount.IsZero() || !msg.Amount.IsValid() {
return fmt.Errorf("amount must be positive or valid")
}
return nil
}

0 comments on commit 905d8f1

Please sign in to comment.