Skip to content

Commit

Permalink
Update to charge gas fee set from params instead of getting it from t…
Browse files Browse the repository at this point in the history
…x gas limit
  • Loading branch information
p0p3yee committed Sep 13, 2023
1 parent 9b1df5e commit ed329b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions x/pep/keeper/msg_server_submit_encrypted_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"context"
cosmosmath "cosmossdk.io/math"
"fairyring/x/pep/types"
"fmt"
"strconv"
Expand Down Expand Up @@ -40,13 +39,11 @@ func (k msgServer) SubmitEncryptedTx(goCtx context.Context, msg *types.MsgSubmit

minGas := k.MinGasPrice(ctx)

deductedCoin := sdk.NewCoin(minGas.Denom, cosmosmath.NewIntFromUint64(ctx.GasMeter().Limit()).Mul(minGas.Amount))

err = k.bankKeeper.SendCoinsFromAccountToModule(
ctx,
senderAddr,
types.ModuleName,
sdk.NewCoins(deductedCoin),
sdk.NewCoins(minGas),
)

if err != nil {
Expand All @@ -58,7 +55,7 @@ func (k msgServer) SubmitEncryptedTx(goCtx context.Context, msg *types.MsgSubmit
TargetHeight: msg.TargetBlockHeight,
Data: msg.Data,
Creator: msg.Creator,
ChargedGas: &deductedCoin,
ChargedGas: &minGas,
}

txIndex := k.AppendEncryptedTx(ctx, encryptedTx)
Expand Down
2 changes: 1 addition & 1 deletion x/pep/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _ paramtypes.ParamSet = (*Params)(nil)

var (
KeyMinGasPrice = []byte("MinGasPrice")
DefaultMinGasPrice = sdk.NewCoin("frt", cosmosmath.NewInt(1))
DefaultMinGasPrice = sdk.NewCoin("frt", cosmosmath.NewInt(300000))
)

// ParamKeyTable the param key table for launch module
Expand Down

0 comments on commit ed329b9

Please sign in to comment.