Skip to content

Commit

Permalink
fix: register initial amount too low error
Browse files Browse the repository at this point in the history
  • Loading branch information
fx0x55 authored and zakir committed Apr 13, 2022
1 parent f506195 commit fe9673d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions x/gov/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"context"
"fmt"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"strconv"

"github.com/armon/go-metrics"
Expand Down Expand Up @@ -34,8 +35,9 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitPro
defer telemetry.IncrCounter(1, types.ModuleName, "proposal")

if k.SupportEGFProposal(ctx) {
if msg.GetInitialDeposit().IsAllLT(k.Keeper.GetEGFDepositParams(ctx).InitialDeposit) {
return nil, fmt.Errorf("initial amount too low")
paramsInitialDeposit := k.Keeper.GetEGFDepositParams(ctx).InitialDeposit
if msg.GetInitialDeposit().IsAllLT(paramsInitialDeposit) {
return nil, sdkerrors.Wrapf(types.ErrInitialAmountTooLow, "%s is smaller than %s", msg.GetInitialDeposit().String(), paramsInitialDeposit.String())
}
}

Expand Down
1 change: 1 addition & 0 deletions x/gov/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ var (
ErrInvalidVote = sdkerrors.Register(ModuleName, 7, "invalid vote option")
ErrInvalidGenesis = sdkerrors.Register(ModuleName, 8, "invalid genesis state")
ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 9, "no handler exists for proposal type")
ErrInitialAmountTooLow = sdkerrors.Register(ModuleName, 10, "initial amount too low")
)

0 comments on commit fe9673d

Please sign in to comment.