Skip to content

Commit

Permalink
fix: error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kstoykov committed Mar 3, 2022
1 parent ddec994 commit 4ef1512
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions module/x/gravity/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ func CmdSendToEth() *cobra.Command {

amount, err := sdk.ParseCoinsNormalized(args[1])
if err != nil {
return sdkerrors.Wrap(err, "amount")
return err
}

bridgeFee, err := sdk.ParseCoinsNormalized(args[2])
if err != nil {
return sdkerrors.Wrap(err, "bridge fee")
return err
}

ethAddr, err := types.NewEthAddress(args[0])
if err != nil {
return sdkerrors.Wrap(err, "invalid eth address")
return err
}

if len(amount) != 1 || len(bridgeFee) != 1 {
Expand Down Expand Up @@ -164,7 +164,7 @@ func CmdSetMinFeeTransferToEth() *cobra.Command {

amount, ok := sdk.NewIntFromString(args[0])
if !ok {
return sdkerrors.Wrap(err, "min-bridge-fee")
return fmt.Errorf("wrong min-bridge-fee %s", args[0])
}

if amount.LT(sdk.OneInt()) {
Expand Down
4 changes: 2 additions & 2 deletions module/x/gravity/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ func (k msgServer) SetMinFeeTransferToEth(c context.Context, msg *types.MsgSetMi
ctx := sdk.UnwrapSDKContext(c)

if msg.Fee.Equal(k.GetMinimumFeeTransferToEth(ctx)) {
return nil, fmt.Errorf("fee min fee should be different from current value")
return nil, sdkerrors.Wrap(types.ErrInvalid, "fee min fee should be different from current value")
}

//get signer admin tokens
sAddr := msg.GetSigners()[0]
sat := k.bankKeeper.GetAllBalances(ctx, sAddr).AmountOf("cudosAdmin")

if sat.LT(sdk.OneInt()) {
return nil, fmt.Errorf("only accounts with admin tokens can change the min bridge fee")
return nil, sdkerrors.Wrap(types.ErrInvalid, "only accounts with admin tokens can change the min bridge fee")
}

k.SetMinimumFeeTransferToEth(ctx, msg.Fee)
Expand Down

0 comments on commit 4ef1512

Please sign in to comment.